Search in sources :

Example 6 with TerminationPoint

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.

the class ElanL2GatewayMulticastUtils method preapareRemoteMcastMacEntry.

/**
 * Update remote mcast mac.
 *
 * @param elanName
 *            the elan name
 * @param device
 *            the device
 * @param dpnsTepIps
 *            the dpns tep ips
 * @param l2GwDevicesTepIps
 *            the l2 gw devices tep ips
 * @return the write transaction
 */
private void preapareRemoteMcastMacEntry(String elanName, L2GatewayDevice device, List<IpAddress> dpnsTepIps, List<IpAddress> l2GwDevicesTepIps) {
    NodeId nodeId = new NodeId(device.getHwvtepNodeId());
    ArrayList<IpAddress> remoteTepIps = new ArrayList<>(l2GwDevicesTepIps);
    remoteTepIps.remove(device.getTunnelIp());
    remoteTepIps.addAll(dpnsTepIps);
    IpAddress dhcpDesignatedSwitchTepIp = getTepIpOfDesignatedSwitchForExternalTunnel(device, elanName);
    if (dpnsTepIps.isEmpty()) {
        // physical locator in l2 gw device
        if (dhcpDesignatedSwitchTepIp != null) {
            remoteTepIps.add(dhcpDesignatedSwitchTepIp);
            HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils.createHwvtepPhysicalLocatorAugmentation(String.valueOf(dhcpDesignatedSwitchTepIp.getValue()));
            InstanceIdentifier<TerminationPoint> iid = HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug);
            TerminationPoint terminationPoint = new TerminationPointBuilder().setKey(HwvtepSouthboundUtils.getTerminationPointKey(phyLocatorAug)).addAugmentation(HwvtepPhysicalLocatorAugmentation.class, phyLocatorAug).build();
            ResourceBatchingManager.getInstance().put(ResourceBatchingManager.ShardResource.CONFIG_TOPOLOGY, iid, terminationPoint);
            LOG.info("Adding PhysicalLocator for node: {} with Dhcp designated switch Tep Ip {} " + "as physical locator, elan {}", device.getHwvtepNodeId(), String.valueOf(dhcpDesignatedSwitchTepIp.getValue()), elanName);
        } else {
            LOG.warn("Dhcp designated switch Tep Ip not found for l2 gw node {} and elan {}", device.getHwvtepNodeId(), elanName);
        }
    }
    if (dhcpDesignatedSwitchTepIp != null && !remoteTepIps.contains(dhcpDesignatedSwitchTepIp)) {
        remoteTepIps.add(dhcpDesignatedSwitchTepIp);
    }
    String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(elanName);
    putRemoteMcastMac(nodeId, logicalSwitchName, remoteTepIps);
    LOG.info("Adding RemoteMcastMac for node: {} with physical locators: {}", device.getHwvtepNodeId(), remoteTepIps);
}
Also used : HwvtepPhysicalLocatorAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) ArrayList(java.util.ArrayList) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 7 with TerminationPoint

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.

the class TestBuilders method buildTerminationPoint.

public static TerminationPoint buildTerminationPoint(InstanceIdentifier<Node> nodeIid, String ip) {
    TerminationPointKey tpKey = new TerminationPointKey(new TpId("vxlan_over_ipv4:" + ip));
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    if (nodeIid != null && tpKey != null) {
        tpBuilder.setKey(tpKey);
        tpBuilder.setTpId(tpKey.getTpId());
        InstanceIdentifier<TerminationPoint> tpPath = buildTpId(nodeIid, ip);
        HwvtepPhysicalLocatorAugmentationBuilder tpAugmentationBuilder = new HwvtepPhysicalLocatorAugmentationBuilder();
        tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
        tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
        tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
        tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
    }
    return tpBuilder.build();
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) HwvtepPhysicalLocatorAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentationBuilder) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 8 with TerminationPoint

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project netvirt by opendaylight.

the class TestComparators method assertTerminationPoint.

public static void assertTerminationPoint(List<String> terminationPointNames, InstanceIdentifier<Node> d1ps, InstanceIdentifier<Node> haPsa, ReadWriteTransaction readWriteTransaction, Node nodeD, Node nodeHa) throws ReadFailedException {
    for (String portName : terminationPointNames) {
        InstanceIdentifier<TerminationPoint> tpPathd = d1ps.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
        TerminationPoint tpNoded = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathd).checkedGet().get();
        HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationD = tpNoded.getAugmentation(HwvtepPhysicalPortAugmentation.class);
        InstanceIdentifier<TerminationPoint> tpPathha = haPsa.child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));
        TerminationPoint tpNodeha = readWriteTransaction.read(LogicalDatastoreType.OPERATIONAL, tpPathha).checkedGet().get();
        HwvtepPhysicalPortAugmentation hwvtepPhysicalPortAugmentationHa = tpNodeha.getAugmentation(HwvtepPhysicalPortAugmentation.class);
        assertEquals("Termination point hwvtep-node-name should be same", hwvtepPhysicalPortAugmentationD.getHwvtepNodeName(), hwvtepPhysicalPortAugmentationHa.getHwvtepNodeName());
        List<VlanBindings> vlanBindingsesD = hwvtepPhysicalPortAugmentationD.getVlanBindings();
        List<VlanBindings> vlanBindingsesHa = hwvtepPhysicalPortAugmentationHa.getVlanBindings();
        assertEquals("Size of VlanBindings should be same", vlanBindingsesD.size(), vlanBindingsesHa.size());
        List<Integer> vlanKeysD = new ArrayList<>();
        List<Integer> vlanKeysHa = new ArrayList<>();
        String logicalSwitchRefD = new String();
        String logicalSwitchRefHa = new String();
        List<String> logicalSwitchNameD = new ArrayList<>();
        List<String> logicalSwitchNameHa = new ArrayList<>();
        if (vlanBindingsesD.size() == vlanBindingsesHa.size()) {
            for (int i = 0; i < vlanBindingsesD.size(); i++) {
                vlanKeysD.add(vlanBindingsesD.get(i).getVlanIdKey().getValue());
                logicalSwitchRefD = vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
                logicalSwitchNameD.add(vlanBindingsesD.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
                vlanKeysHa.add(vlanBindingsesHa.get(i).getVlanIdKey().getValue());
                logicalSwitchRefHa = vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(Node.class).getNodeId().getValue();
                logicalSwitchNameHa.add(vlanBindingsesHa.get(i).getLogicalSwitchRef().getValue().firstKeyOf(LogicalSwitches.class).getHwvtepNodeName().getValue());
            }
            assertTrue(vlanKeysD.containsAll(vlanKeysHa));
            assertTrue(logicalSwitchRefD.equals(nodeD.getNodeId().getValue()));
            assertTrue(logicalSwitchRefHa.equals(nodeHa.getNodeId().getValue()));
            assertTrue(logicalSwitchNameD.containsAll(logicalSwitchNameHa));
        }
    }
}
Also used : LogicalSwitches(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) ArrayList(java.util.ArrayList) HwvtepPhysicalPortAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) VlanBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)

Example 9 with TerminationPoint

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project bgpcep by opendaylight.

the class NodeChangedListenerTest method testNodeChangedListener.

@Test
public void testNodeChangedListener() throws ReadFailedException, TransactionCommitFailedException {
    // add node -> create two nodes with TPs and link
    createNode(NODE1_ID, NODE1_IPV4, LSP1_NAME, LSP1_ID, NODE2_IPV4);
    final Topology tunnelTopo = readDataOperational(getDataBroker(), TUNNEL_TOPO_IID, tunnelTopo1 -> {
        assertNotNull(tunnelTopo1.getNode());
        assertEquals(2, tunnelTopo1.getNode().size());
        return tunnelTopo1;
    });
    final NodeId srcId = new NodeId("ip://" + new IpAddress(new Ipv4Address(NODE1_IPV4)));
    final NodeId dstId = new NodeId("ip://" + new IpAddress(new Ipv4Address(NODE2_IPV4)));
    final Node dst;
    final Node src;
    if (tunnelTopo.getNode().get(0).getNodeId().equals(srcId)) {
        src = tunnelTopo.getNode().get(0);
        dst = tunnelTopo.getNode().get(1);
    } else {
        src = tunnelTopo.getNode().get(1);
        dst = tunnelTopo.getNode().get(0);
    }
    Assert.assertEquals(srcId, src.getNodeId());
    Assert.assertEquals(dstId, dst.getNodeId());
    Assert.assertEquals(1, dst.getTerminationPoint().size());
    Assert.assertEquals(1, src.getTerminationPoint().size());
    final TerminationPoint dstTp = dst.getTerminationPoint().get(0);
    final TerminationPoint srcTp = src.getTerminationPoint().get(0);
    final TpId dstNodeTpId = new TpId(dstId.getValue());
    final TpId srcNodeTpId = new TpId(srcId.getValue());
    Assert.assertEquals(dstNodeTpId, dstTp.getTpId());
    Assert.assertEquals(srcNodeTpId, srcTp.getTpId());
    Assert.assertEquals(1, src.getSupportingNode().size());
    Assert.assertNull(dst.getSupportingNode());
    final SupportingNode sNode = src.getSupportingNode().get(0);
    Assert.assertEquals(NODE1_ID, sNode.getKey().getNodeRef());
    Assert.assertEquals(1, tunnelTopo.getLink().size());
    final Link link = tunnelTopo.getLink().get(0);
    Assert.assertEquals(srcId, link.getSource().getSourceNode());
    Assert.assertEquals(srcNodeTpId, link.getSource().getSourceTp());
    Assert.assertEquals(dstId, link.getDestination().getDestNode());
    Assert.assertEquals(dstNodeTpId, link.getDestination().getDestTp());
    // update second node -> adds supporting node and second link
    createNode(NODE2_ID, NODE2_IPV4, LSP2_NAME, LSP2_ID, NODE1_IPV4);
    readDataOperational(getDataBroker(), TUNNEL_TOPO_IID, updatedNodeTopo -> {
        assertNotNull(updatedNodeTopo.getNode());
        Assert.assertEquals(2, updatedNodeTopo.getNode().size());
        final Node updatedNode;
        if (updatedNodeTopo.getNode().get(0).getNodeId().equals(srcId)) {
            updatedNode = updatedNodeTopo.getNode().get(1);
        } else {
            updatedNode = updatedNodeTopo.getNode().get(0);
        }
        assertNotNull(updatedNode.getSupportingNode());
        Assert.assertEquals(1, updatedNode.getSupportingNode().size());
        final SupportingNode sNode2 = updatedNode.getSupportingNode().get(0);
        Assert.assertEquals(NODE2_ID, sNode2.getNodeRef());
        Assert.assertEquals(2, updatedNodeTopo.getLink().size());
        return updatedNodeTopo;
    });
    readDataOperational(getDataBroker(), TUNNEL_TOPO_IID, updatedNodeTopo -> {
        final Link link2;
        if (updatedNodeTopo.getLink().get(0).getSource().getSourceNode().equals(srcId)) {
            link2 = updatedNodeTopo.getLink().get(1);
        } else {
            link2 = updatedNodeTopo.getLink().get(0);
        }
        assertEquals(dstId, link2.getSource().getSourceNode());
        assertEquals(dstNodeTpId, link2.getSource().getSourceTp());
        assertEquals(srcId, link2.getDestination().getDestNode());
        assertEquals(srcNodeTpId, link2.getDestination().getDestTp());
        return updatedNodeTopo;
    });
    // remove nodes -> remove link
    removeNode(NODE1_ID);
    removeNode(NODE2_ID);
    readDataOperational(getDataBroker(), TUNNEL_TOPO_IID, removedNodeTopo -> {
        assertEquals(0, removedNodeTopo.getNode().size());
        assertEquals(0, removedNodeTopo.getLink().size());
        return removedNodeTopo;
    });
}
Also used : TpId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) Link(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Link) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) AbstractConcurrentDataBrokerTest(org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest) Test(org.junit.Test)

Example 10 with TerminationPoint

use of org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint in project bgpcep by opendaylight.

the class CreateTunnelInstructionExecutor method buildArguments.

private Arguments buildArguments(final TerminationPoint sp, final TerminationPoint dp) {
    final ArgumentsBuilder args = new ArgumentsBuilder();
    if (this.p2pTunnelInput.getBandwidth() != null) {
        args.setBandwidth(new BandwidthBuilder().setBandwidth(this.p2pTunnelInput.getBandwidth()).build());
    }
    if (this.p2pTunnelInput.getClassType() != null) {
        args.setClassType(new ClassTypeBuilder().setClassType(this.p2pTunnelInput.getClassType()).build());
    }
    args.setEndpointsObj(new EndpointsObjBuilder().setAddressFamily(buildAddressFamily(sp, dp)).build());
    args.setEro(TunelProgrammingUtil.buildEro(this.p2pTunnelInput.getExplicitHops()));
    args.setLspa(new LspaBuilder(this.p2pTunnelInput).build());
    final AdministrativeStatus adminStatus = this.p2pTunnelInput.getAugmentation(PcepCreateP2pTunnelInput1.class).getAdministrativeStatus();
    if (adminStatus != null) {
        args.addAugmentation(Arguments2.class, new Arguments2Builder().setLsp(new LspBuilder().setAdministrative(adminStatus == AdministrativeStatus.Active).build()).build());
    }
    return args.build();
}
Also used : LspaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.LspaBuilder) Arguments2Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Arguments2Builder) PcepCreateP2pTunnelInput1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PcepCreateP2pTunnelInput1) LspBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.LspBuilder) ArgumentsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.add.lsp.args.ArgumentsBuilder) AdministrativeStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.AdministrativeStatus) ClassTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.classtype.object.ClassTypeBuilder) EndpointsObjBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder) BandwidthBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder)

Aggregations

TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)41 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)25 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)20 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)18 TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)16 ArrayList (java.util.ArrayList)12 NodeId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId)10 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)8 HwvtepPhysicalPortAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation)7 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)7 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)7 Test (org.junit.Test)6 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)6 VlanBindings (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.port.attributes.VlanBindings)6 NetworkTopology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology)6 Topology (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology)6 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)5 OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)5 BigInteger (java.math.BigInteger)4 List (java.util.List)3