Search in sources :

Example 16 with ExternalTunnel

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel in project genius by opendaylight.

the class ItmExternalTunnelAddTest method testBuildHwVtepsTunnels.

@Test
public void testBuildHwVtepsTunnels() {
    final Interface extTunnelIf1 = ItmUtils.buildTunnelInterface(dpId1, "tun030025bd04f", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, tunnelType1, tunnelEndPointsVxlan.getIpAddress(), ipAddress1, gtwyIp1, vlanId, false, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL, false, null);
    final Interface hwTunnelIf2 = ItmUtils.buildHwTunnelInterface("tun9a55a9c38f2", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, hwVtep1.getTopoId(), hwVtep1.getNodeId(), tunnelType1, ipAddress1, ipAddress3, gtwyIp1, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL);
    final Interface extTunnelIf3 = ItmUtils.buildTunnelInterface(dpId1, "tun17c6e20c283", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, tunnelType1, tunnelEndPointsVxlan.getIpAddress(), ipAddress2, gtwyIp1, vlanId, false, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL, false, null);
    final Interface hwTunnelIf4 = ItmUtils.buildHwTunnelInterface("tunaa109b6c8c5", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, hwVtep1.getTopoId(), destination, tunnelType1, ipAddress2, ipAddress3, gtwyIp1, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL);
    final Interface hwTunnelIf5 = ItmUtils.buildHwTunnelInterface("tund903ed434d5", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, hwVtep1.getTopoId(), hwVtep1.getNodeId(), tunnelType1, ipAddress1, ipAddress2, gtwyIp1, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL);
    final Interface hwTunnelIf6 = ItmUtils.buildHwTunnelInterface("tunc3315b110a6", String.format("%s %s", tunnelType1.getName(), "Trunk Interface"), true, hwVtep1.getTopoId(), destination, tunnelType1, ipAddress2, ipAddress1, gtwyIp1, false, monitorProtocol, ITMConstants.BFD_DEFAULT_MONITOR_INTERVAL);
    final ExternalTunnel externalTunnel1 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(dpId1.toString()), getExternalTunnelKey(source), tunnelType1, "tun030025bd04f");
    final ExternalTunnel externalTunnel2 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(source), getExternalTunnelKey(dpId1.toString()), tunnelType1, "tun9a55a9c38f2");
    final ExternalTunnel externalTunnel3 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(dpId1.toString()), getExternalTunnelKey(destination), tunnelType1, "tun17c6e20c283");
    final ExternalTunnel externalTunnel4 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(destination), getExternalTunnelKey(dpId1.toString()), tunnelType1, "tunaa109b6c8c5");
    final ExternalTunnel externalTunnel5 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(source), getExternalTunnelKey(destination), tunnelType1, "tund903ed434d5");
    final ExternalTunnel externalTunnel6 = ItmUtils.buildExternalTunnel(getExternalTunnelKey(destination), getExternalTunnelKey(source), tunnelType1, "tunc3315b110a6");
    InstanceIdentifier<TransportZone> transportZoneIdentifier = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(transportZone1)).build();
    final InstanceIdentifier<Interface> ifIID1 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tun030025bd04f")).build();
    final InstanceIdentifier<Interface> ifIID2 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tun9a55a9c38f2")).build();
    final InstanceIdentifier<Interface> ifIID3 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tun17c6e20c283")).build();
    final InstanceIdentifier<Interface> ifIID4 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tunaa109b6c8c5")).build();
    final InstanceIdentifier<Interface> ifIID5 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tund903ed434d5")).build();
    final InstanceIdentifier<Interface> ifIID6 = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey("tunc3315b110a6")).build();
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier1 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(source), getExternalTunnelKey(dpId1.toString()), tunnelType1));
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier2 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dpId1.toString()), getExternalTunnelKey(source), tunnelType1));
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier3 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(destination), getExternalTunnelKey(dpId1.toString()), tunnelType1));
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier4 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dpId1.toString()), getExternalTunnelKey(destination), tunnelType1));
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier5 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(destination), getExternalTunnelKey(source), tunnelType1));
    final InstanceIdentifier<ExternalTunnel> externalTunnelIdentifier6 = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(source), getExternalTunnelKey(destination), tunnelType1));
    Optional<TransportZone> optionalTransportZone = Optional.of(transportZone);
    doReturn(Futures.immediateCheckedFuture(optionalTransportZone)).when(mockReadTx).read(LogicalDatastoreType.CONFIGURATION, transportZoneIdentifier);
    externalTunnelAddWorker.buildHwVtepsTunnels(cfgdDpnListVxlan, null);
    externalTunnelAddWorker.buildHwVtepsTunnels(null, cfgdHwVtepsList);
    verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, ifIID1, extTunnelIf1, true);
    verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier1, externalTunnel1, true);
    verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, ifIID2, hwTunnelIf2, true);
    verify(mockWriteTx, times(2)).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier2, externalTunnel2, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, ifIID3, extTunnelIf3, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier3, externalTunnel3, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, ifIID4, hwTunnelIf4, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier4, externalTunnel4, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, ifIID5, hwTunnelIf5, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier5, externalTunnel5, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, ifIID6, hwTunnelIf6, true);
    verify(mockWriteTx).merge(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier6, externalTunnel6, true);
}
Also used : ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey) Test(org.junit.Test)

Example 17 with ExternalTunnel

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel in project genius by opendaylight.

the class ItmExternalTunnelAddTest method setupMocks.

private void setupMocks() {
    ipAddress1 = IpAddressBuilder.getDefaultInstance(tepIp1);
    ipAddress2 = IpAddressBuilder.getDefaultInstance(tepIp2);
    ipAddress3 = IpAddressBuilder.getDefaultInstance(tepIp3);
    gtwyIp1 = IpAddressBuilder.getDefaultInstance(gwyIp1);
    gtwyIp2 = IpAddressBuilder.getDefaultInstance(gwyIp2);
    ipPrefixTest = IpPrefixBuilder.getDefaultInstance(subnetIp + "/24");
    tunnelEndPointsVxlan = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName1).setIpAddress(ipAddress3).setGwIpAddress(gtwyIp1).setInterfaceName(parentInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType1).setSubnetMask(ipPrefixTest).build();
    tunnelEndPointsListVxlan.add(tunnelEndPointsVxlan);
    dpntePsInfoVxlan = new DPNTEPsInfoBuilder().setDPNID(dpId1).setUp(true).setKey(new DPNTEPsInfoKey(dpId1)).setTunnelEndPoints(tunnelEndPointsListVxlan).build();
    deviceVteps1 = new DeviceVtepsBuilder().setIpAddress(ipAddress1).setKey(new DeviceVtepsKey(ipAddress1, source)).setNodeId(source).setTopologyId("hwvtep:1").build();
    deviceVteps2 = new DeviceVtepsBuilder().setIpAddress(ipAddress2).setKey(new DeviceVtepsKey(ipAddress2, destination)).setNodeId(destination).setTopologyId("hwvtep:1").build();
    hwVtep1 = new HwVtep();
    hwVtep1.setTransportZone(transportZone1);
    hwVtep1.setGatewayIP(gtwyIp1);
    hwVtep1.setHwIp(ipAddress1);
    hwVtep1.setTunnelType(tunnelType1);
    hwVtep1.setVlanID(vlanId);
    hwVtep1.setTopoId("hwvtep:1");
    hwVtep1.setNodeId(source);
    hwVtep1.setIpPrefix(ipPrefixTest);
    cfgdDpnListVxlan.add(dpntePsInfoVxlan);
    cfgdHwVtepsList.add(hwVtep1);
    bigIntegerList.add(dpId1);
    deviceVtepsList.add(deviceVteps1);
    deviceVtepsList.add(deviceVteps2);
    vtepsTest = new VtepsBuilder().setDpnId(dpId1).setIpAddress(ipAddress3).setPortname(portName1).setKey(new VtepsKey(dpId1, portName1)).build();
    vtepsList.add(vtepsTest);
    dpnEndpointsVxlan = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListVxlan).build();
    transportZone = new TransportZoneBuilder().setTunnelType(tunnelType1).setZoneName(transportZone1).setKey(new TransportZoneKey(transportZone1)).setSubnets(subnetsList).build();
    idOutputOptional1 = RpcResultBuilder.success(expectedId1).buildFuture();
    getIdInput1 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.101:192.168.56.40:VXLAN").build();
    doReturn(idOutputOptional1).when(idManagerService).allocateId(getIdInput1);
    idOutputOptional2 = RpcResultBuilder.success(expectedId2).buildFuture();
    getIdInput2 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("1:phy0:100:192.168.56.101:192.168.56.30:VXLAN").build();
    doReturn(idOutputOptional2).when(idManagerService).allocateId(getIdInput2);
    idOutputOptional3 = RpcResultBuilder.success(expectedId3).buildFuture();
    getIdInput3 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("hwvtep:1:hwvtep://192.168.101.30:6640/physicalswitch/s3:192.168.56.30:192.168.56.101:VXLAN").build();
    doReturn(idOutputOptional3).when(idManagerService).allocateId(getIdInput3);
    idOutputOptional4 = RpcResultBuilder.success(expectedId4).buildFuture();
    getIdInput4 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("hwvtep:1:hwvtep://192.168.101.40:6640/physicalswitch/s4:192.168.56.40:192.168.56.101:VXLAN").build();
    doReturn(idOutputOptional4).when(idManagerService).allocateId(getIdInput4);
    idOutputOptional5 = RpcResultBuilder.success(expectedId5).buildFuture();
    getIdInput5 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("hwvtep:1:hwvtep://192.168.101.30:6640/physicalswitch/s3:192.168.56.30:192.168.56.40:VXLAN").build();
    doReturn(idOutputOptional5).when(idManagerService).allocateId(getIdInput5);
    idOutputOptional6 = RpcResultBuilder.success(expectedId6).buildFuture();
    getIdInput6 = new AllocateIdInputBuilder().setPoolName(ITMConstants.ITM_IDPOOL_NAME).setIdKey("hwvtep:1:hwvtep://192.168.101.40:6640/physicalswitch/s4:192.168.56.40:192.168.56.30:VXLAN").build();
    doReturn(idOutputOptional6).when(idManagerService).allocateId(getIdInput6);
    tunnelMonitorParams = new TunnelMonitorParamsBuilder().setEnabled(true).build();
    tunnelMonitorInterval = new TunnelMonitorIntervalBuilder().setInterval(interval).build();
    trunkInterfaceName = ItmUtils.getTrunkInterfaceName(parentInterfaceName, String.valueOf(tunnelEndPointsVxlan.getIpAddress().getValue()), String.valueOf(ipAddress2.getValue()), tunnelType1.getName());
    interfaceIdentifier = ItmUtils.buildId(trunkInterfaceName);
    externalTunnelIdentifier = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(String.valueOf(ipAddress2.getValue()), dpId1.toString(), tunnelType1));
    iface = ItmUtils.buildTunnelInterface(dpId1, trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(tunnelType1), "Trunk Interface"), true, tunnelType1, ipAddress3, ipAddress2, gtwyIp1, tunnelEndPointsVxlan.getVLANID(), false, false, monitorProtocol, null, false, null);
    externalTunnel = ItmUtils.buildExternalTunnel(dpId1.toString(), String.valueOf(ipAddress2.getValue()), tunnelType1, trunkInterfaceName);
    subnets = new SubnetsBuilder().setGatewayIp(gtwyIp1).setVlanId(vlanId).setKey(new SubnetsKey(ipPrefixTest)).setVteps(vtepsList).setDeviceVteps(deviceVtepsList).build();
    subnetsList.add(subnets);
    doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
    doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
Also used : SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) DPNTEPsInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder) VtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsKey) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) TunnelMonitorParamsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder) TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) HwVtep(org.opendaylight.genius.itm.confighelpers.HwVtep) VtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.VtepsBuilder) DeviceVtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder) TunnelEndPointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder) DPNTEPsInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey) AllocateIdInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.AllocateIdInputBuilder) DeviceVtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder) SubnetsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder) DpnEndpointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder) TransportZoneBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Example 18 with ExternalTunnel

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel in project genius by opendaylight.

the class ItmUtils method getExternalTunnel.

public static ExternalTunnel getExternalTunnel(String interfaceName, DataBroker broker) {
    ExternalTunnel externalTunnel = ITM_CACHE.getExternalTunnel(interfaceName);
    if (externalTunnel == null) {
        updateTunnelsCache(broker);
        externalTunnel = ITM_CACHE.getExternalTunnel(interfaceName);
    }
    return externalTunnel;
}
Also used : ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)

Example 19 with ExternalTunnel

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel in project genius by opendaylight.

the class ItmUtils method getExtTunnel.

private static String getExtTunnel(String nodeId, String dpId, Class<? extends TunnelTypeBase> tunType, DataBroker dataBroker) {
    LOG.trace("getting ext tunnel for {} and dpId {}", nodeId, dpId);
    ExternalTunnelKey key = getExternalTunnelKey(dpId, nodeId, tunType);
    InstanceIdentifier<ExternalTunnel> intIID = InstanceIdentifier.builder(ExternalTunnelList.class).child(ExternalTunnel.class, key).build();
    Optional<ExternalTunnel> tunnelsOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, intIID, dataBroker);
    if (tunnelsOptional.isPresent()) {
        String tunnelInterfaceName = tunnelsOptional.get().getTunnelInterfaceName();
        LOG.trace("ext tunnel returned {} ", tunnelInterfaceName);
        return tunnelInterfaceName;
    }
    return null;
}
Also used : ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)

Example 20 with ExternalTunnel

use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel in project genius by opendaylight.

the class ItmExternalTunnelAddWorker method wireUp.

// for tunnels from TOR device
private boolean wireUp(String topoId, String srcNodeid, IpAddress srcIp, String dstNodeId, IpAddress dstIp, IpPrefix srcSubnet, IpAddress gwIp, IpPrefix dstSubnet, Class<? extends TunnelTypeBase> tunType, Boolean monitorEnabled, Integer monitorInterval, Class<? extends TunnelMonitoringTypeBase> monitorProtocol, WriteTransaction transaction) {
    IpAddress gatewayIpObj = IpAddressBuilder.getDefaultInstance("0.0.0.0");
    IpAddress gwyIpAddress = srcSubnet.equals(dstSubnet) ? gatewayIpObj : gwIp;
    String parentIf = ItmUtils.getHwParentIf(topoId, srcNodeid);
    String tunTypeStr = tunType.getName();
    String tunnelIfName = ItmUtils.getTrunkInterfaceName(parentIf, new String(srcIp.getValue()), new String(dstIp.getValue()), tunTypeStr);
    LOG.debug(" Creating ExternalTrunk Interface with parameters Name - {}, parent I/f name - {}, " + "source IP - {}, destination IP - {} gateway IP - {}", tunnelIfName, parentIf, srcIp, dstIp, gwyIpAddress);
    Interface hwTunnelIf = ItmUtils.buildHwTunnelInterface(tunnelIfName, String.format("%s %s", tunType.getName(), "Trunk Interface"), true, topoId, srcNodeid, tunType, srcIp, dstIp, gwyIpAddress, monitorEnabled, monitorProtocol, monitorInterval);
    InstanceIdentifier<Interface> ifIID = InstanceIdentifier.builder(Interfaces.class).child(Interface.class, new InterfaceKey(tunnelIfName)).build();
    LOG.trace(" Writing Trunk Interface to Config DS {}, {} ", ifIID, hwTunnelIf);
    ItmUtils.ITM_CACHE.addInterface(hwTunnelIf);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, ifIID, hwTunnelIf, true);
    // also update itm-state ds?
    InstanceIdentifier<ExternalTunnel> path = InstanceIdentifier.create(ExternalTunnelList.class).child(ExternalTunnel.class, new ExternalTunnelKey(getExternalTunnelKey(dstNodeId), getExternalTunnelKey(srcNodeid), tunType));
    ExternalTunnel tnl = ItmUtils.buildExternalTunnel(getExternalTunnelKey(srcNodeid), getExternalTunnelKey(dstNodeId), tunType, tunnelIfName);
    transaction.merge(LogicalDatastoreType.CONFIGURATION, path, tnl, true);
    ItmUtils.ITM_CACHE.addExternalTunnel(tnl);
    return true;
}
Also used : ExternalTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) ExternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) InterfaceKey(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Aggregations

ExternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnel)17 ExternalTunnelKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey)10 ExternalTunnelList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.ExternalTunnelList)8 Interface (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)6 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)5 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)4 DPNTEPsInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder)4 DPNTEPsInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey)4 TunnelEndPointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder)4 TransportZoneBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder)4 SubnetsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder)4 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)4 DeviceVtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder)4 DeviceVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey)4 BigInteger (java.math.BigInteger)3 InterfaceKey (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey)3 DpnEndpointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder)3 DPNTEPsInfo (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfo)3 TunnelEndPoints (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPoints)3 ExternalTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelBuilder)3