Search in sources :

Example 6 with TerminationPointBuilder

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

the class InterfaceManagerConfigurationTest method rebuildTerminationPoint.

private TerminationPoint rebuildTerminationPoint(TerminationPoint tp) {
    // The problem we're fixing here is that, in MD-SAL binding v1, YANG lists are represented
    // as Java lists but they don't preserve order (unless they specify “ordered-by user”).
    // YANG keyed lists in particular are backed by maps, so you can store such a list in the
    // MD-SAL and get it back in a different order.
    // When comparing beans involving such lists, we need to sort the lists before comparing
    // them. Retrieving the augmentation gives a modifiable list, so it's tempting to just
    // sort that — but the list is re-created every time the augmentation is retrieved, so
    // the sort is lost.
    // To avoid all this, we rebuild instances of TerminationPoint, and sort the affected lists
    // in the augmentations, with full augmentation rebuilds too (since the lists in a built
    // augmentation might be unmodifiable).
    TerminationPointBuilder newTpBuilder = new TerminationPointBuilder(tp);
    OvsdbTerminationPointAugmentation ovsdbTpAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
    if (ovsdbTpAugmentation != null) {
        OvsdbTerminationPointAugmentationBuilder newOvsdbTpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(ovsdbTpAugmentation);
        if (ovsdbTpAugmentation.getOptions() != null) {
            List<Options> options = new ArrayList<>(ovsdbTpAugmentation.getOptions());
            options.sort(Comparator.comparing(o -> o.getKey().toString()));
            newOvsdbTpAugmentationBuilder.setOptions(options);
        }
        if (ovsdbTpAugmentation.getInterfaceBfd() != null) {
            List<InterfaceBfd> interfaceBfd = new ArrayList<>(ovsdbTpAugmentation.getInterfaceBfd());
            interfaceBfd.sort(Comparator.comparing(o -> o.getKey().toString()));
            newOvsdbTpAugmentationBuilder.setInterfaceBfd(interfaceBfd);
        }
        newTpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, newOvsdbTpAugmentationBuilder.build());
    }
    return newTpBuilder.build();
}
Also used : Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) InterfaceNameEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryKey) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation) Table(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table) GetEgressInstructionsForInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressInstructionsForInterfaceInput) GetTunnelTypeOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeOutput) TRUNK_INTERFACE_NAME(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.TRUNK_INTERFACE_NAME) GetDpnInterfaceListInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpnInterfaceListInputBuilder) BridgeRefEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry) PARENT_INTERFACE_1(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.PARENT_INTERFACE_1) ServiceIndex(org.opendaylight.genius.utils.ServiceIndex) Future(java.util.concurrent.Future) GuiceRule(org.opendaylight.infrautils.inject.guice.testutils.GuiceRule) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) PARENT_INTERFACE(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.PARENT_INTERFACE) Optional(com.google.common.base.Optional) JobCoordinatorCountedEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorCountedEventsWaiter) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) PARENT_INTERFACE_2(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.PARENT_INTERFACE_2) EgressActionsForInterfaceOutput(org.opendaylight.genius.interfacemanager.test.xtend.EgressActionsForInterfaceOutput) BigInteger(java.math.BigInteger) ExpectedInterfaceState(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceState) NodeconnectorIdFromInterfaceOutput(org.opendaylight.genius.interfacemanager.test.xtend.NodeconnectorIdFromInterfaceOutput) InterfaceTypeOutput(org.opendaylight.genius.interfacemanager.test.xtend.InterfaceTypeOutput) BoundServices(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices) GetNodeconnectorIdFromInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInputBuilder) ExpectedOvsdbBridge(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedOvsdbBridge) GetInterfaceTypeInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeInput) TerminationPoint(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint) BoundServicesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey) TransactionCommitFailedException(org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) GetEgressInstructionsForInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressInstructionsForInterfaceInputBuilder) GetEndpointIpForDpnOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEndpointIpForDpnOutput) BridgeEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.BridgeEntryKey) LogCaptureRule(org.opendaylight.infrautils.testutils.LogCaptureRule) ServicesInfoKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey) DEFAULT_OPERATIONAL(org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.BatchingUtils.EntityType.DEFAULT_OPERATIONAL) ServiceModeIngress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress) OdlInterfaceRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService) ServicesInfo(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo) TunnelTypeOutput(org.opendaylight.genius.interfacemanager.test.xtend.TunnelTypeOutput) MINUTES(java.util.concurrent.TimeUnit.MINUTES) TUNNEL_INTERFACE_NAME(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.TUNNEL_INTERFACE_NAME) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) IfL2vlan(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.IfL2vlan) ArrayList(java.util.ArrayList) INTERFACE_NAME_1(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.INTERFACE_NAME_1) INTERFACE_NAME_2(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.INTERFACE_NAME_2) GetDpidFromInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInput) GetPortFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceOutput) BridgeRefEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey) InterfaceTypeVxlan(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.InterfaceTypeVxlan) GetPortFromInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInputBuilder) GetDpidFromInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInputBuilder) Before(org.junit.Before) InterfaceInfo(org.opendaylight.genius.interfacemanager.globals.InterfaceInfo) GetEgressActionsForInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInput) DpnToInterfaceList(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.DpnToInterfaceList) InterfaceManagerTestUtil.waitTillOperationCompletes(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.waitTillOperationCompletes) GetDpidFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceOutput) Test(org.junit.Test) ExpectedBoundServiceState(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedBoundServiceState) DpnToInterface(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterface) L2vlan(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan) AsyncEventsWaiter(org.opendaylight.genius.datastoreutils.testutils.AsyncEventsWaiter) GetNodeconnectorIdFromInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceOutput) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) INTERFACE_NAME(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.INTERFACE_NAME) FlowBasedServicesUtils(org.opendaylight.genius.interfacemanager.servicebindings.flowbased.utilities.FlowBasedServicesUtils) Assert(org.junit.Assert) ExpectedInterfaceInfo(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceInfo) PORT_NO_1(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.PORT_NO_1) Tunnel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) SingleTransactionDataBroker(org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker) InterfaceChildEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntry) InterfaceType(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType) MethodRule(org.junit.rules.MethodRule) ExpectedInterfaceChildEntry(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceChildEntry) EndPointIpFromDpn(org.opendaylight.genius.interfacemanager.test.xtend.EndPointIpFromDpn) InterfaceParentEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info.InterfaceParentEntryKey) GetEndpointIpForDpnInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEndpointIpForDpnInputBuilder) CONFIGURATION(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.CONFIGURATION) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) JobCoordinatorTestModule(org.opendaylight.genius.datastoreutils.testutils.JobCoordinatorTestModule) GetInterfaceTypeInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeInputBuilder) GetTunnelTypeInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeInputBuilder) GetPortFromInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetPortFromInterfaceInput) OPERATIONAL(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType.OPERATIONAL) ParentRefs(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefs) GetEndpointIpForDpnInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEndpointIpForDpnInput) ExpectedTerminationPoint(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedTerminationPoint) After(org.junit.After) GetEgressInstructionsForInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressInstructionsForInterfaceOutput) GetTunnelTypeInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetTunnelTypeInput) VLAN_INTERFACE_INGRESS_TABLE(org.opendaylight.genius.mdsalutil.NwConstants.VLAN_INTERFACE_INGRESS_TABLE) InterfaceBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd) GetInterfaceTypeOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetInterfaceTypeOutput) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) PortFromInterfaceOutput(org.opendaylight.genius.interfacemanager.test.xtend.PortFromInterfaceOutput) Interfaces(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.get.dpn._interface.list.output.Interfaces) Interface(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface) WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) List(java.util.List) ParentRefsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rev160406.ParentRefsBuilder) ExpectedServicesInfo(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedServicesInfo) InterfaceChildEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406._interface.child.info._interface.parent.entry.InterfaceChildEntryKey) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) DpnToInterfaceKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.DpnToInterfaceKey) BatchingUtils(org.opendaylight.genius.interfacemanager.renderer.ovs.utilities.BatchingUtils) FlowId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId) ServiceBindings(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings) Inject(javax.inject.Inject) TestableQueues(org.opendaylight.genius.interfacemanager.test.infra.TestableQueues) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) AssertDataObjects.assertEqualBeans(org.opendaylight.mdsal.binding.testutils.AssertDataObjects.assertEqualBeans) ExpectedFlowEntries(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedFlowEntries) ExpectedInterfaceConfig(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceConfig) DEFAULT_EGRESS_SERVICE_INDEX(org.opendaylight.genius.mdsalutil.NwConstants.DEFAULT_EGRESS_SERVICE_INDEX) ExpectedInterfaceListFromDpn(org.opendaylight.genius.interfacemanager.test.xtend.ExpectedInterfaceListFromDpn) NwConstants(org.opendaylight.genius.mdsalutil.NwConstants) DpnFromInterfaceOutput(org.opendaylight.genius.interfacemanager.test.xtend.DpnFromInterfaceOutput) ServiceModeEgress(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) IInterfaceManager(org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager) IfmUtil(org.opendaylight.genius.interfacemanager.IfmUtil) GetDpnInterfaceListInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpnInterfaceListInput) BridgeInterfaceEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.bridge.entry.BridgeInterfaceEntry) TestableDataTreeChangeListenerModule(org.opendaylight.genius.datastoreutils.testutils.TestableDataTreeChangeListenerModule) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) BridgeInterfaceEntryKey(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge._interface.info.bridge.entry.BridgeInterfaceEntryKey) InterfaceNameEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntryBuilder) LogRule(org.opendaylight.infrautils.testutils.LogRule) GetEgressActionsForInterfaceOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceOutput) EgressInstructionsForInterfaceOutput(org.opendaylight.genius.interfacemanager.test.xtend.EgressInstructionsForInterfaceOutput) Rule(org.junit.Rule) GetNodeconnectorIdFromInterfaceInput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetNodeconnectorIdFromInterfaceInput) Ignore(org.junit.Ignore) DPN_ID_1(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.DPN_ID_1) GetDpnInterfaceListOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpnInterfaceListOutput) DPN_ID_2(org.opendaylight.genius.interfacemanager.test.InterfaceManagerTestUtil.DPN_ID_2) InterfaceMetaUtils(org.opendaylight.genius.interfacemanager.commons.InterfaceMetaUtils) GetEgressActionsForInterfaceInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetEgressActionsForInterfaceInputBuilder) InterfaceMeta(org.opendaylight.genius.interfacemanager.test.xtend.InterfaceMeta) InterfaceNameEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.dpn.to._interface.list.dpn.to._interface.InterfaceNameEntry) Comparator(java.util.Comparator) FlowAssertTestUtils(org.opendaylight.genius.mdsalutil.interfaces.testutils.FlowAssertTestUtils) Options(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.Options) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) ArrayList(java.util.ArrayList) InterfaceBfd(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) OvsdbTerminationPointAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)

Example 7 with TerminationPointBuilder

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

the class OvsdbSouthboundTestUtil method updateTerminationPoint.

public static void updateTerminationPoint(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceTypeBase> type) throws TransactionCommitFailedException {
    final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
    final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
    InstanceIdentifier<TerminationPoint> tpId = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), interfaceName);
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpId));
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(interfaceName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    List<InterfaceBfdStatus> interfaceBfdStatuses = Arrays.asList(new InterfaceBfdStatusBuilder().setBfdStatusKey("state").setBfdStatusValue("down").build());
    tpAugmentationBuilder.setInterfaceBfdStatus(interfaceBfdStatuses);
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.merge(OPERATIONAL, tpId, tpBuilder.build(), true);
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) InterfaceBfdStatusBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatusBuilder) OvsdbBridgeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) InterfaceBfdStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfdStatus) 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 TerminationPointBuilder

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

the class OvsdbSouthboundTestUtil method createTerminationPoint.

public static void createTerminationPoint(DataBroker dataBroker, String interfaceName, Class<? extends InterfaceTypeBase> type, String externalId) throws TransactionCommitFailedException {
    final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
    final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
    InstanceIdentifier<TerminationPoint> tpId = createTerminationPointInstanceIdentifier(InstanceIdentifier.keyOf(bridgeIid.firstIdentifierOf(Node.class)), interfaceName);
    TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setKey(InstanceIdentifier.keyOf(tpId));
    OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
    tpAugmentationBuilder.setName(interfaceName);
    if (type != null) {
        tpAugmentationBuilder.setInterfaceType(type);
    }
    if (externalId != null) {
        List<InterfaceExternalIds> interfaceExternalIds = new ArrayList<>();
        InterfaceExternalIds interfaceExternalIds1 = new InterfaceExternalIdsBuilder().setExternalIdKey("iface-id").setExternalIdValue(externalId).build();
        interfaceExternalIds.add(interfaceExternalIds1);
        tpAugmentationBuilder.setInterfaceExternalIds(interfaceExternalIds);
    }
    tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
    WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
    tx.put(OPERATIONAL, tpId, tpBuilder.build(), true);
    tx.submit().checkedGet();
}
Also used : WriteTransaction(org.opendaylight.controller.md.sal.binding.api.WriteTransaction) InterfaceExternalIds(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIds) OvsdbBridgeName(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) OvsdbTerminationPointAugmentationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder) ArrayList(java.util.ArrayList) 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) InterfaceExternalIdsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceExternalIdsBuilder)

Example 9 with TerminationPointBuilder

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

the class HwvtepUtils method putPhysicalLocator.

/**
 * Put physical locator in the transaction.
 *
 * @param transaction
 *            the transaction
 * @param nodeId
 *            the node id
 * @param phyLocator
 *            the phy locator
 */
public static void putPhysicalLocator(final WriteTransaction transaction, final NodeId nodeId, final HwvtepPhysicalLocatorAugmentation phyLocator) {
    InstanceIdentifier<TerminationPoint> iid = HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocator);
    TerminationPoint terminationPoint = new TerminationPointBuilder().setKey(HwvtepSouthboundUtils.getTerminationPointKey(phyLocator)).addAugmentation(HwvtepPhysicalLocatorAugmentation.class, phyLocator).build();
    transaction.put(LogicalDatastoreType.CONFIGURATION, iid, terminationPoint, true);
}
Also used : HwvtepPhysicalLocatorAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation) 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 10 with TerminationPointBuilder

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

the class TunnelProgrammingTest method createNode.

private static Node createNode(final NodeId nodeId, final TpId tpId, final String ipv4Address) {
    final TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
    tpBuilder.setTpId(tpId);
    tpBuilder.setKey(new TerminationPointKey(tpId));
    tpBuilder.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder().setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder().setTerminationPointType(new IpBuilder().setIpAddress(Collections.singletonList(new IpAddress(new Ipv4Address(ipv4Address)))).build()).build()).build());
    final NodeBuilder nodeBuilder = new NodeBuilder();
    nodeBuilder.setNodeId(nodeId);
    nodeBuilder.setKey(new NodeKey(nodeId));
    nodeBuilder.setTerminationPoint(Lists.newArrayList(tpBuilder.build()));
    final SupportingNode supportingNode = new SupportingNodeBuilder().setKey(new SupportingNodeKey(nodeId, new TopologyId("dummy"))).addAugmentation(SupportingNode1.class, new SupportingNode1Builder().setPathComputationClient(new PathComputationClientBuilder().setControlling(true).build()).build()).build();
    nodeBuilder.setSupportingNode(Lists.newArrayList(supportingNode));
    return nodeBuilder.build();
}
Also used : SupportingNodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder) TerminationPointKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey) PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.tunnel.pcep.supporting.node.attributes.PathComputationClientBuilder) TerminationPointBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) SupportingNode1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1) NodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder) SupportingNodeBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder) SupportingNode1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.tunnel.pcep.rev130820.SupportingNode1Builder) IpBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.igp.termination.point.attributes.termination.point.type.IpBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) IgpTerminationPointAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.termination.point.attributes.IgpTerminationPointAttributesBuilder) SupportingNodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) TerminationPoint1Builder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)

Aggregations

TerminationPointBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointBuilder)17 TerminationPoint (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint)12 OvsdbTerminationPointAugmentationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentationBuilder)7 Node (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node)6 TerminationPointKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPointKey)6 ArrayList (java.util.ArrayList)5 WriteTransaction (org.opendaylight.controller.md.sal.binding.api.WriteTransaction)3 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)3 NodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder)3 BigInteger (java.math.BigInteger)2 HwvtepPhysicalLocatorAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation)2 OvsdbBridgeName (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeName)2 OvsdbTerminationPointAugmentation (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation)2 InterfaceBfd (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.ovsdb.port._interface.attributes.InterfaceBfd)2 TpId (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TpId)2 NodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)2 SupportingNode (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode)2 SupportingNodeBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeBuilder)2 SupportingNodeKey (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNodeKey)2 TerminationPoint1Builder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.TerminationPoint1Builder)2