summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java43
1 files changed, 15 insertions, 28 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
index eb8525949..9b786917d 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/translate/v3po/interfaces/ip/SubInterfaceIpv4AddressCustomizer.java
@@ -24,6 +24,7 @@ import io.fd.honeycomb.translate.vpp.util.NamingContext;
import io.fd.honeycomb.translate.vpp.util.SubInterfaceUtils;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
@@ -36,8 +37,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.address.subnet.Netmask;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.ip4.attributes.ipv4.address.subnet.PrefixLength;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import io.fd.vpp.jvpp.VppBaseCallException;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -105,40 +104,28 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer
@Nonnull final String subInterfaceName, final int subInterfaceIndex,
@Nonnull final Address address, @Nonnull final Netmask subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- final DottedQuad netmask = subnet.getNetmask();
- checkNotNull(netmask, "netmask value should not be null");
+ LOG.debug("Setting Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
- final byte subnetLength = getSubnetMaskLength(netmask.getValue());
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(), subnetLength);
+ final DottedQuad netmask = subnet.getNetmask();
+ checkNotNull(netmask, "netmask value should not be null");
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(subnet-mask) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+ final byte subnetLength = getSubnetMaskLength(netmask.getValue());
+ addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(), subnetLength);
}
private void setPrefixLengthSubnet(final boolean add, @Nonnull final InstanceIdentifier<Address> id,
@Nonnull final String subInterfaceName, final int subInterfaceIndex,
@Nonnull final Address address, @Nonnull final PrefixLength subnet)
throws WriteFailedException {
- try {
- LOG.debug("Setting Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
-
- addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(),
- subnet.getPrefixLength().byteValue());
-
- LOG.debug("Subnet(prefix-length) set successfully for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- } catch (VppBaseCallException e) {
- LOG.warn("Failed to set Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
- subInterfaceName, subInterfaceIndex, subnet, address);
- throw new WriteFailedException(id, "Unable to handle subnet of type " + subnet.getClass(), e);
- }
+ LOG.debug("Setting Subnet(prefix-length) for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
+
+ addDelAddress(getFutureJVpp(), add, id, subInterfaceIndex, address.getIp(),
+ subnet.getPrefixLength().byteValue());
+
+ LOG.debug("Subnet(prefix-length) set successfully for sub-interface: {}(id={}). Subnet: {}, address: {}",
+ subInterfaceName, subInterfaceIndex, subnet, address);
}
}