#!/bin/sh

ip=`ip -4 addr show $1 | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`

if [ "$ip" = "" ] ; then
    exit 0
fi

echo -n '<ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"><address><ip>'
echo -n "$ip"
echo '</ip></address></ipv4>'
