Search in sources :

Example 1 with InternalTunnelKey

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

the class ItmManagerRpcServiceTest method setUp.

@Before
public void setUp() throws Exception {
    deviceVteps = new DeviceVtepsBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setKey(new DeviceVtepsKey(ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.SOURCE_DEVICE)).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
    deviceVtepsList.add(deviceVteps);
    stringList.add(ItmTestConstants.SOURCE_DEVICE);
    dpId1List.add(ItmTestConstants.DP_ID_1);
    stringList.add(ItmTestConstants.SOURCE_DEVICE_2);
    trunkInterfaceName = ItmUtils.getTrunkInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME, String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue()), String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue()), ItmTestConstants.TUNNEL_TYPE_VXLAN.getName());
    interfaceIdentifier = ItmUtils.buildId(trunkInterfaceName);
    tunnelEndPointsVxlan = new TunnelEndPointsBuilder().setVLANID(ItmTestConstants.VLAN_ID).setPortname(ItmTestConstants.PORT_NAME_1).setIpAddress(ItmTestConstants.IP_ADDRESS_3).setGwIpAddress(ItmTestConstants.GTWY_IP_1).setInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).setTzMembership(ItmUtils.createTransportZoneMembership(ItmTestConstants.TZ_NAME)).setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setSubnetMask(ItmTestConstants.IP_PREFIX_TEST).setKey(new TunnelEndPointsKey(ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.PORT_NAME_1, ItmTestConstants.TUNNEL_TYPE_VXLAN, ItmTestConstants.VLAN_ID)).build();
    tunnelEndPointsListVxlan.add(tunnelEndPointsVxlan);
    dpntePsInfoVxlan = new DPNTEPsInfoBuilder().setDPNID(ItmTestConstants.DP_ID_1).setKey(new DPNTEPsInfoKey(ItmTestConstants.DP_ID_1)).setUp(true).setTunnelEndPoints(tunnelEndPointsListVxlan).build();
    cfgdDpnListVxlan.add(dpntePsInfoVxlan);
    dpnEndpoints = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListVxlan).build();
    internalTunnel = new InternalTunnelBuilder().setTunnelInterfaceNames(Collections.singletonList(ItmTestConstants.PARENT_INTERFACE_NAME)).setDestinationDPN(ItmTestConstants.DP_ID_2).setSourceDPN(ItmTestConstants.DP_ID_1).setTransportType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setKey(new InternalTunnelKey(ItmTestConstants.DP_ID_2, ItmTestConstants.DP_ID_1, ItmTestConstants.TUNNEL_TYPE_VXLAN)).build();
    getExternalInterfaceNameInput = new GetInternalOrExternalInterfaceNameInputBuilder().setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setSourceDpid(ItmTestConstants.DP_ID_1).setTunnelType(ItmTestConstants.TUNNEL_TYPE_MPLS_OVER_GRE).build();
    getInternalInterfaceNameInput = new GetInternalOrExternalInterfaceNameInputBuilder().setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setSourceDpid(ItmTestConstants.DP_ID_1).setTunnelType(ItmTestConstants.TUNNEL_TYPE_MPLS_OVER_GRE).build();
    addExternalTunnelEndpointInput = new AddExternalTunnelEndpointInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).build();
    addL2GwDeviceInput = new AddL2GwDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
    deleteL2GwDeviceInput = new DeleteL2GwDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(ItmTestConstants.SOURCE_DEVICE).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
    addL2GwMlagDeviceInput = new AddL2GwMlagDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(stringList).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
    deleteL2GwMlagDeviceInput = new DeleteL2GwMlagDeviceInputBuilder().setIpAddress(ItmTestConstants.IP_ADDRESS_3).setNodeId(stringList).setTopologyId(ItmTestConstants.DESTINATION_DEVICE).build();
    buildExternalTunnelFromDpnsInput = new BuildExternalTunnelFromDpnsInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setDpnId(dpId1List).build();
    removeExternalTunnelFromDpnsInput = new RemoveExternalTunnelFromDpnsInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).setDpnId(dpId1List).build();
    removeExternalTunnelEndpointInput = new RemoveExternalTunnelEndpointInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationIp(ItmTestConstants.IP_ADDRESS_3).build();
    getTunnelInterfaceNameInput = new GetTunnelInterfaceNameInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setSourceDpid(ItmTestConstants.DP_ID_1).setDestinationDpid(ItmTestConstants.DP_ID_2).build();
    getExternalTunnelInterfaceNameInput = new GetExternalTunnelInterfaceNameInputBuilder().setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setDestinationNode(ItmTestConstants.DESTINATION_DEVICE).setSourceNode(ItmTestConstants.SOURCE_DEVICE).build();
    iface = ItmUtils.buildTunnelInterface(ItmTestConstants.DP_ID_1, trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(ItmTestConstants.TUNNEL_TYPE_VXLAN), "Trunk Interface"), true, ItmTestConstants.TUNNEL_TYPE_VXLAN, tunnelEndPointsVxlan.getIpAddress(), ItmTestConstants.IP_ADDRESS_3, ItmTestConstants.GTWY_IP_1, tunnelEndPointsVxlan.getVLANID(), false, false, ItmTestConstants.MONITOR_PROTOCOL, null, false, null);
    subnetsTest = new SubnetsBuilder().setGatewayIp(ItmTestConstants.GTWY_IP_1).setVlanId(ItmTestConstants.VLAN_ID).setKey(new SubnetsKey(ItmTestConstants.IP_PREFIX_TEST)).setDeviceVteps(deviceVtepsList).build();
    subnetsList.add(subnetsTest);
    transportZone = new TransportZoneBuilder().setZoneName(ItmTestConstants.TZ_NAME).setTunnelType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setKey(new TransportZoneKey(ItmTestConstants.TZ_NAME)).setSubnets(subnetsList).build();
    transportZoneList.add(transportZone);
    transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
    // build external tunnel objects
    externalTunnel = new ExternalTunnelBuilder().setSourceDevice(ItmTestConstants.DP_ID_1.toString()).setDestinationDevice(String.valueOf(ItmTestConstants.IP_ADDRESS_3.getValue())).setTransportType(TunnelTypeMplsOverGre.class).setTunnelInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
    externalTunnel2 = new ExternalTunnelBuilder().setSourceDevice(ItmTestConstants.SOURCE_DEVICE).setDestinationDevice(ItmTestConstants.DESTINATION_DEVICE).setTransportType(ItmTestConstants.TUNNEL_TYPE_VXLAN).setTunnelInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
    getInternalOrExternalInterfaceNameOutput = new GetInternalOrExternalInterfaceNameOutputBuilder().setInterfaceName(ItmTestConstants.PARENT_INTERFACE_NAME).build();
    // commit external tunnel into config DS
    ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier, externalTunnel, dataBroker);
    ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, externalTunnelIdentifier2, externalTunnel2, dataBroker);
    // commit internal tunnel into config DS
    ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, internalTunnelIdentifier, internalTunnel, dataBroker);
    // commit dpnEndpoints into config DS
    ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, dpnEndpointsIdentifier, dpnEndpoints, dataBroker);
    // commit TZ into config DS
    ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, transportZonesIdentifier, transportZones, dataBroker);
}
Also used : BuildExternalTunnelFromDpnsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.BuildExternalTunnelFromDpnsInputBuilder) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) AddL2GwDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwDeviceInputBuilder) GetInternalOrExternalInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameInputBuilder) TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) GetExternalTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInputBuilder) RemoveExternalTunnelFromDpnsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelFromDpnsInputBuilder) DPNTEPsInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey) SubnetsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder) InternalTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelBuilder) AddL2GwMlagDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwMlagDeviceInputBuilder) TunnelEndPointsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsKey) DPNTEPsInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder) InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder) TunnelTypeMplsOverGre(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeMplsOverGre) AddExternalTunnelEndpointInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddExternalTunnelEndpointInputBuilder) TunnelEndPointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder) DeleteL2GwMlagDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwMlagDeviceInputBuilder) DeviceVtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder) ExternalTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelBuilder) DeleteL2GwDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwDeviceInputBuilder) GetInternalOrExternalInterfaceNameOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameOutputBuilder) 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) RemoveExternalTunnelEndpointInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelEndpointInputBuilder) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey) Before(org.junit.Before)

Example 2 with InternalTunnelKey

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

the class ItmUtils method getInternalTunnelsofTzone.

public static List<String> getInternalTunnelsofTzone(String tzone, DataBroker dataBroker) {
    List<String> tunnels = new ArrayList<>();
    LOG.trace("Getting internal tunnels of {}", tzone);
    InstanceIdentifier<TransportZone> path = InstanceIdentifier.builder(TransportZones.class).child(TransportZone.class, new TransportZoneKey(tzone)).build();
    Optional<TransportZone> transportZoneOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, path, dataBroker);
    if (transportZoneOptional.isPresent()) {
        TransportZone transportZone = transportZoneOptional.get();
        if (transportZone.getSubnets() != null && !transportZone.getSubnets().isEmpty()) {
            for (Subnets sub : transportZone.getSubnets()) {
                if (sub.getVteps() != null && !sub.getVteps().isEmpty()) {
                    for (Vteps vtepLocal : sub.getVteps()) {
                        for (Vteps vtepRemote : sub.getVteps()) {
                            if (!vtepLocal.equals(vtepRemote)) {
                                InternalTunnelKey key = new InternalTunnelKey(vtepRemote.getDpnId(), vtepLocal.getDpnId(), transportZone.getTunnelType());
                                InstanceIdentifier<InternalTunnel> intIID = InstanceIdentifier.builder(TunnelList.class).child(InternalTunnel.class, key).build();
                                Optional<InternalTunnel> tunnelsOptional = ItmUtils.read(LogicalDatastoreType.CONFIGURATION, intIID, dataBroker);
                                if (tunnelsOptional.isPresent()) {
                                    List<String> tunnelInterfaceNames = tunnelsOptional.get().getTunnelInterfaceNames();
                                    if (tunnelInterfaceNames != null && !tunnelInterfaceNames.isEmpty()) {
                                        String tunnelInterfaceName = tunnelInterfaceNames.get(0);
                                        LOG.trace("Internal Tunnel added {}", tunnelInterfaceName);
                                        tunnels.add(tunnelInterfaceName);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    return tunnels;
}
Also used : InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) ArrayList(java.util.ArrayList) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) TransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZone) TepsInNotHostedTransportZone(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone) Subnets(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.Subnets) Vteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.Vteps) TepsInNotHostedTransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZoneKey) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Example 3 with InternalTunnelKey

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

the class ItmInternalTunnelDeleteWorker method removeTrunkInterface.

private void removeTrunkInterface(TunnelEndPoints srcTep, TunnelEndPoints dstTep, BigInteger srcDpnId, BigInteger dstDpnId, WriteTransaction transaction) {
    String trunkfwdIfName = ItmUtils.getTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing forward Trunk Interface {}", trunkfwdIfName);
    InstanceIdentifier<Interface> trunkIdentifier = ItmUtils.buildId(trunkfwdIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkfwdIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInterface(trunkfwdIfName);
    // also update itm-state ds -- Delete the forward tunnel-interface from the tunnel list
    InstanceIdentifier<InternalTunnel> path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(dstDpnId, srcDpnId, srcTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkfwdIfName);
    // Release the Ids for the forward trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(srcTep.getInterfaceName(), new String(srcTep.getIpAddress().getValue()), new String(dstTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    removeLogicalGroupTunnel(srcDpnId, dstDpnId);
    String trunkRevIfName = ItmUtils.getTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), srcTep.getTunnelType().getName());
    LOG.trace("Removing Reverse Trunk Interface {}", trunkRevIfName);
    trunkIdentifier = ItmUtils.buildId(trunkRevIfName);
    LOG.debug(" Removing Trunk Interface Name - {} , Id - {} from Config DS ", trunkRevIfName, trunkIdentifier);
    transaction.delete(LogicalDatastoreType.CONFIGURATION, trunkIdentifier);
    ItmUtils.ITM_CACHE.removeInternalTunnel(trunkRevIfName);
    // also update itm-state ds -- Delete the reverse tunnel-interface from the tunnel list
    path = InstanceIdentifier.create(TunnelList.class).child(InternalTunnel.class, new InternalTunnelKey(srcDpnId, dstDpnId, dstTep.getTunnelType()));
    transaction.delete(LogicalDatastoreType.CONFIGURATION, path);
    // Release the Ids for the reverse trunk interface Name
    ItmUtils.releaseIdForTrunkInterfaceName(dstTep.getInterfaceName(), new String(dstTep.getIpAddress().getValue()), new String(srcTep.getIpAddress().getValue()), dstTep.getTunnelType().getName());
    removeLogicalGroupTunnel(dstDpnId, srcDpnId);
}
Also used : InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) TunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelList) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface)

Example 4 with InternalTunnelKey

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

the class ItmManagerRpcServiceTest method setupMocks.

private void setupMocks() {
    deviceVteps = new DeviceVtepsBuilder().setIpAddress(ipAddress1).setKey(new DeviceVtepsKey(ipAddress1, "abc")).setNodeId(sourceDevice).setTopologyId(destinationDevice).build();
    deviceVtepsList.add(deviceVteps);
    stringList.add(sourceDevice);
    dpId1List.add(dpId1);
    stringList.add("def");
    trunkInterfaceName = ItmUtils.getTrunkInterfaceName(tunnelInterfaceName, String.valueOf(ipAddress1.getValue()), String.valueOf(ipAddress1.getValue()), tunnelType1.getName());
    interfaceIdentifier = ItmUtils.buildId(trunkInterfaceName);
    tunnelEndPointsVxlan = new TunnelEndPointsBuilder().setVLANID(vlanId).setPortname(portName1).setIpAddress(ipAddress1).setGwIpAddress(gtwyIp1).setInterfaceName(tunnelInterfaceName).setTzMembership(ItmUtils.createTransportZoneMembership(transportZone1)).setTunnelType(tunnelType1).setSubnetMask(ipPrefixTest).setKey(new TunnelEndPointsKey(ipAddress1, portName1, tunnelType1, vlanId)).build();
    tunnelEndPointsListVxlan.add(tunnelEndPointsVxlan);
    dpntePsInfoVxlan = new DPNTEPsInfoBuilder().setDPNID(dpId1).setKey(new DPNTEPsInfoKey(dpId1)).setUp(true).setTunnelEndPoints(tunnelEndPointsListVxlan).build();
    cfgdDpnListVxlan.add(dpntePsInfoVxlan);
    dpnEndpoints = new DpnEndpointsBuilder().setDPNTEPsInfo(cfgdDpnListVxlan).build();
    externalTunnel = new ExternalTunnelBuilder().setSourceDevice(sourceDevice).setDestinationDevice(destinationDevice).setTransportType(tunnelType1).setTunnelInterfaceName(tunnelInterfaceName).setKey(new ExternalTunnelKey(destinationDevice, sourceDevice, tunnelType1)).build();
    internalTunnel = new InternalTunnelBuilder().setTunnelInterfaceNames(Collections.singletonList(tunnelInterfaceName)).setDestinationDPN(dpId2).setSourceDPN(dpId1).setTransportType(tunnelType1).setKey(new InternalTunnelKey(dpId2, dpId1, tunnelType1)).build();
    getInternalOrExternalInterfaceNameInput = new GetInternalOrExternalInterfaceNameInputBuilder().setDestinationIp(ipAddress1).setSourceDpid(dpId1).setTunnelType(tunnelType2).build();
    addExternalTunnelEndpointInput = new AddExternalTunnelEndpointInputBuilder().setTunnelType(tunnelType1).setDestinationIp(ipAddress1).build();
    addL2GwDeviceInput = new AddL2GwDeviceInputBuilder().setIpAddress(ipAddress1).setNodeId(sourceDevice).setTopologyId(destinationDevice).build();
    deleteL2GwDeviceInput = new DeleteL2GwDeviceInputBuilder().setIpAddress(ipAddress1).setNodeId(sourceDevice).setTopologyId(destinationDevice).build();
    addL2GwMlagDeviceInput = new AddL2GwMlagDeviceInputBuilder().setIpAddress(ipAddress1).setNodeId(stringList).setTopologyId(destinationDevice).build();
    deleteL2GwMlagDeviceInput = new DeleteL2GwMlagDeviceInputBuilder().setIpAddress(ipAddress1).setNodeId(stringList).setTopologyId(destinationDevice).build();
    buildExternalTunnelFromDpnsInput = new BuildExternalTunnelFromDpnsInputBuilder().setTunnelType(tunnelType1).setDestinationIp(ipAddress1).setDpnId(dpId1List).build();
    removeExternalTunnelFromDpnsInput = new RemoveExternalTunnelFromDpnsInputBuilder().setTunnelType(tunnelType1).setDestinationIp(ipAddress1).setDpnId(dpId1List).build();
    removeExternalTunnelEndpointInput = new RemoveExternalTunnelEndpointInputBuilder().setTunnelType(tunnelType1).setDestinationIp(ipAddress1).build();
    removeTerminatingServiceActionsInput = new RemoveTerminatingServiceActionsInputBuilder().setServiceId(vlanId).setDpnId(dpId1).build();
    getTunnelInterfaceNameInput = new GetTunnelInterfaceNameInputBuilder().setTunnelType(tunnelType1).setSourceDpid(dpId1).setDestinationDpid(dpId2).build();
    getExternalTunnelInterfaceNameInput = new GetExternalTunnelInterfaceNameInputBuilder().setTunnelType(tunnelType1).setDestinationNode(destinationDevice).setSourceNode(sourceDevice).build();
    iface = ItmUtils.buildTunnelInterface(dpId1, trunkInterfaceName, String.format("%s %s", ItmUtils.convertTunnelTypetoString(tunnelType1), "Trunk Interface"), true, tunnelType1, tunnelEndPointsVxlan.getIpAddress(), ipAddress1, gtwyIp1, tunnelEndPointsVxlan.getVLANID(), false, false, monitorProtocol, null, false, null);
    subnetsTest = new SubnetsBuilder().setGatewayIp(gtwyIp1).setVlanId(vlanId).setKey(new SubnetsKey(ipPrefixTest)).setDeviceVteps(deviceVtepsList).build();
    subnetsList.add(subnetsTest);
    transportZone = new TransportZoneBuilder().setZoneName(transportZone1).setTunnelType(tunnelType1).setKey(new TransportZoneKey(transportZone1)).setSubnets(subnetsList).build();
    transportZoneList.add(transportZone);
    transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
    doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
    doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
Also used : BuildExternalTunnelFromDpnsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.BuildExternalTunnelFromDpnsInputBuilder) RemoveTerminatingServiceActionsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveTerminatingServiceActionsInputBuilder) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) ExternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelKey) AddL2GwDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwDeviceInputBuilder) GetInternalOrExternalInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetInternalOrExternalInterfaceNameInputBuilder) TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) GetExternalTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetExternalTunnelInterfaceNameInputBuilder) RemoveExternalTunnelFromDpnsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelFromDpnsInputBuilder) DPNTEPsInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey) SubnetsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder) InternalTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelBuilder) AddL2GwMlagDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddL2GwMlagDeviceInputBuilder) TunnelEndPointsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsKey) DPNTEPsInfoBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder) InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) GetTunnelInterfaceNameInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.GetTunnelInterfaceNameInputBuilder) AddExternalTunnelEndpointInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.AddExternalTunnelEndpointInputBuilder) TunnelEndPointsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder) DeleteL2GwMlagDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwMlagDeviceInputBuilder) DeviceVtepsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder) ExternalTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelBuilder) DeleteL2GwDeviceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.DeleteL2GwDeviceInputBuilder) 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) RemoveExternalTunnelEndpointInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rpcs.rev160406.RemoveExternalTunnelEndpointInputBuilder) TransportZoneKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)

Example 5 with InternalTunnelKey

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

the class TepCommandHelperTest method setupMocks.

private void setupMocks() {
    System.setOut(new PrintStream(outContent));
    instanceIdentifierList.add(transportZoneIdentifier);
    instanceIdentifierList.add(vtepsIdentifier);
    instanceIdentifierList.add(subnetsIdentifier);
    DeviceVteps deviceVteps = new DeviceVtepsBuilder().setIpAddress(ipAddress1).setKey(new DeviceVtepsKey(ipAddress1, sourceDevice)).setNodeId(sourceDevice).setTopologyId(destinationDevice).build();
    vteps = new VtepsBuilder().setPortname(portName1).setDpnId(dpId2).setIpAddress(ipAddress1).setKey(new VtepsKey(dpId2, portName1)).build();
    vtepsTest = new VtepsBuilder().build();
    deviceVtepsList.add(deviceVteps);
    vtepsList.add(vteps);
    subnetsTest = new SubnetsBuilder().setGatewayIp(gtwyIp1).setVlanId(vlanId).setKey(new SubnetsKey(ipPrefixTest)).setDeviceVteps(deviceVtepsList).setVteps(vtepsList).build();
    subnetsList.add(subnetsTest);
    transportZone = new TransportZoneBuilder().setZoneName(transportZone1).setTunnelType(tunnelType1).setKey(new TransportZoneKey(transportZone1)).setSubnets(subnetsList).build();
    transportZoneNew = new TransportZoneBuilder().setZoneName(transportZone1).setTunnelType(tunnelType2).setKey(new TransportZoneKey(transportZone1)).setSubnets(subnetsList).build();
    transportZoneList.add(transportZone);
    transportZones = new TransportZonesBuilder().setTransportZone(transportZoneList).build();
    transportZonesNew = new TransportZonesBuilder().setTransportZone(transportZoneListNew).build();
    tunnelMonitorInterval = new TunnelMonitorIntervalBuilder().setInterval(10000).build();
    tunnelMonitorParams = new TunnelMonitorParamsBuilder().setEnabled(true).build();
    InternalTunnel internalTunnelTest = new InternalTunnelBuilder().setSourceDPN(dpId1).setDestinationDPN(dpId2).setTunnelInterfaceNames(Collections.singletonList(tunnelInterfaceName)).setKey(new InternalTunnelKey(dpId1, dpId2, tunnelType1)).setTransportType(tunnelType1).build();
    internalTunnelList.add(internalTunnelTest);
    StateTunnelList stateTunnelListTest = new StateTunnelListBuilder().setTunnelInterfaceName(tunnelInterfaceName).setOperState(TunnelOperStatus.Up).build();
    stateTunnelList.add(stateTunnelListTest);
    lowerLayerIfList.add(dpId1.toString());
    interfaceTest = new InterfaceBuilder().setOperStatus(Interface.OperStatus.Up).setAdminStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.AdminStatus.Up).setPhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress.getDefaultInstance("AA:AA:AA:AA:AA:AA")).setIfIndex(100).setLowerLayerIf(lowerLayerIfList).setType(L2vlan.class).build();
    interfaceTestNew = ItmUtils.buildTunnelInterface(dpId1, tunnelInterfaceName, destinationDevice, enabled, TunnelTypeVxlan.class, ipAddress1, ipAddress2, gtwyIp1, vlanId, true, enabled, monitorProtocol, interval, false, null);
    doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
    doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
    doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
Also used : DeviceVteps(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVteps) PrintStream(java.io.PrintStream) SubnetsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey) StateTunnelListBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelListBuilder) 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) TunnelMonitorParamsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorParamsBuilder) InternalTunnelKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey) TransportZonesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder) TunnelMonitorIntervalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.TunnelMonitorIntervalBuilder) StateTunnelList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnels_state.StateTunnelList) DeviceVtepsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey) InternalTunnel(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel) InterfaceBuilder(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.InterfaceBuilder) TunnelTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.TunnelTypeVxlan) 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) 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) InternalTunnelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelBuilder) 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)

Aggregations

InternalTunnelKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelKey)7 InternalTunnel (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnel)5 TransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneKey)5 InternalTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.tunnel.list.InternalTunnelBuilder)3 TransportZonesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.TransportZonesBuilder)3 TransportZoneBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.TransportZoneBuilder)3 SubnetsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsBuilder)3 SubnetsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.SubnetsKey)3 DeviceVtepsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsBuilder)3 DeviceVtepsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.transport.zones.transport.zone.subnets.DeviceVtepsKey)3 ArrayList (java.util.ArrayList)2 DpnEndpointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.DpnEndpointsBuilder)2 TunnelList (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.TunnelList)2 DPNTEPsInfoBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoBuilder)2 DPNTEPsInfoKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.DPNTEPsInfoKey)2 TunnelEndPointsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsBuilder)2 TunnelEndPointsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.dpn.endpoints.dpn.teps.info.TunnelEndPointsKey)2 ExternalTunnelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.op.rev160406.external.tunnel.list.ExternalTunnelBuilder)2 TepsInNotHostedTransportZone (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZone)2 TepsInNotHostedTransportZoneKey (org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.rev160406.not.hosted.transport.zones.TepsInNotHostedTransportZoneKey)2