From 5aa62ee7d2be070b2ffef0443b59c8891ed06845 Mon Sep 17 00:00:00 2001 From: Jozef Gloncak Date: Tue, 9 Feb 2016 15:03:53 +0100 Subject: Adding vxlan tunnel id allocator. Change-Id: Id638bc0262481921cd42d830e9fc788e76bc3907 Signed-off-by: Jozef Gloncak --- .../src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java') diff --git a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java index 489f6c796..3378e6817 100644 --- a/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java +++ b/vbd/impl/src/main/java/io/fd/honeycomb/vbd/impl/VppModifier.java @@ -146,15 +146,16 @@ public class VppModifier { return resultFuture; } - void createVirtualInterfaceOnVpp(final Ipv4AddressNoZone ipSrc, final Ipv4AddressNoZone ipDst, final KeyedInstanceIdentifier iiToVpp) { + void createVirtualInterfaceOnVpp(final Ipv4AddressNoZone ipSrc, final Ipv4AddressNoZone ipDst, final KeyedInstanceIdentifier iiToVpp, + final Integer vxlanTunnelId) { final Vxlan vxlanData = prepareVxlan(ipSrc, ipDst); - final Interface intfData = prepareVirtualInterfaceData(vxlanData); + final Interface intfData = prepareVirtualInterfaceData(vxlanData, vxlanTunnelId); final DataBroker vppDataBroker = VbdUtil.resolveDataBrokerForMountPoint(iiToVpp, mountService); if (vppDataBroker != null) { final WriteTransaction wTx = vppDataBroker.newWriteOnlyTransaction(); final KeyedInstanceIdentifier iiToInterface - = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(BridgeDomain.TUNNEL_ID_DEMO)); + = InstanceIdentifier.create(Interfaces.class).child(Interface.class, new InterfaceKey(VbdUtil.provideVxlanId(vxlanTunnelId))); wTx.put(LogicalDatastoreType.CONFIGURATION, iiToInterface, intfData); final CheckedFuture submitFuture = wTx.submit(); Futures.addCallback(submitFuture, new FutureCallback() { @@ -169,14 +170,14 @@ public class VppModifier { } }); } else { - LOG.debug("Writing virtual interface {} to VPP {} wasn't successfull because missing data broker.", BridgeDomain.TUNNEL_ID_DEMO, iiToVpp); + LOG.debug("Writing virtual interface {} to VPP {} wasn't successfull because missing data broker.", VbdUtil.provideVxlanId(vxlanTunnelId), iiToVpp); } } - private Interface prepareVirtualInterfaceData(final Vxlan vxlan) { + private Interface prepareVirtualInterfaceData(final Vxlan vxlan, Integer vxlanTunnelId) { final InterfaceBuilder interfaceBuilder = new InterfaceBuilder(); //TODO implement tunnel counter - interfaceBuilder.setName(BridgeDomain.TUNNEL_ID_DEMO); + interfaceBuilder.setName(VbdUtil.provideVxlanId(vxlanTunnelId)); interfaceBuilder.setType(VxlanTunnel.class); VppInterfaceAugmentationBuilder vppInterfaceAugmentationBuilder = new VppInterfaceAugmentationBuilder(); vppInterfaceAugmentationBuilder.setVxlan(vxlan); -- cgit 1.2.3-korg