Java源码示例:org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology

示例1
@Test
public void configFileTest() throws InterruptedException, ExecutionException {
    final KeyedInstanceIdentifier<Topology, TopologyKey> topologyIIdKeyed =
            InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
                    new TopologyKey(new TopologyId("topology-test")));
    checkNotPresentConfiguration(getDataBroker(), topologyIIdKeyed);

    assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/network-topology-config.xml"));
    final NetworkTopologyConfigFileProcessor processor = new NetworkTopologyConfigFileProcessor(this.configLoader,
            getDataBroker());
    processor.init();
    checkPresentConfiguration(getDataBroker(), topologyIIdKeyed);

    assertEquals(SchemaPath.create(true, NetworkTopology.QNAME), processor.getSchemaPath());
    processor.close();
}
 
示例2
private synchronized void createTunnelTopologyProvider(final Topology topology) {
    if (!filterPcepTopologies(topology.getTopologyTypes())) {
        return;
    }
    final TopologyId topologyId = topology.getTopologyId();
    if (this.pcepTunnelServices.containsKey(topology.getTopologyId())) {
        LOG.warn("Tunnel Topology {} already exist. New instance won't be created", topologyId);
        return;
    }
    LOG.debug("Create Tunnel Topology {}", topologyId);

    final PcepTunnelTopologyConfig config = topology.augmentation(PcepTunnelTopologyConfig.class);
    final String pcepTopoID = StringUtils
            .substringBetween(config.getPcepTopologyReference().getValue(), "=\"", "\"");
    final InstanceIdentifier<Topology> pcepTopoRef = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(pcepTopoID))).build();


    final PCEPTunnelClusterSingletonService tunnelTopoCss =
            new PCEPTunnelClusterSingletonService(this.dependencies, pcepTopoRef, topologyId);
    this.pcepTunnelServices.put(topology.getTopologyId(), tunnelTopoCss);
}
 
示例3
@Before
public void setUp() throws Exception {
    rpcService = new TopologyStatsRpcServiceImpl(getDataBroker());
    rpcService.init();

    // PCEP topology with one PCC node
    final Topology t1 = createTopology(TOPOLOGY_ID1, Collections.singletonList(createPcepNode(NODE_ID1)));

    // PCEP topology with two PCC node
    final Topology t2 =
            createTopology(TOPOLOGY_ID2, Arrays.asList(createPcepNode(NODE_ID2), createPcepNode(NODE_ID3)));

    // Non-PCEP topology with one non-PCC node
    final Topology t3 = createTopology(NONPCEP_TOPOLOGY,
            Collections.singletonList(new NodeBuilder().setNodeId(new NodeId(NONPCEP_NODE)).build()));

    final WriteTransaction wtx = getDataBroker().newWriteOnlyTransaction();
    final NetworkTopologyBuilder ntb = new NetworkTopologyBuilder();
    ntb.setTopology(Arrays.asList(t1, t2, t3));
    wtx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(),
            ntb.build());
    wtx.commit().get();
}
 
示例4
public static InstanceIdentifier<Node> getInstanceIdentifier(final InstanceIdentifierCodec instanceIdentifierCodec,
        final OpenVSwitch ovs) {
    if (ovs.getExternalIdsColumn() != null
            && ovs.getExternalIdsColumn().getData() != null
            && ovs.getExternalIdsColumn().getData().containsKey(SouthboundConstants.IID_EXTERNAL_ID_KEY)) {
        String iidString = ovs.getExternalIdsColumn().getData().get(SouthboundConstants.IID_EXTERNAL_ID_KEY);
        return (InstanceIdentifier<Node>) instanceIdentifierCodec.bindingDeserializerOrNull(iidString);
    } else {
        String nodeString = SouthboundConstants.OVSDB_URI_PREFIX + "://" + SouthboundConstants.UUID + "/"
                + ovs.getUuid().toString();
        NodeId nodeId = new NodeId(new Uri(nodeString));
        NodeKey nodeKey = new NodeKey(nodeId);
        return InstanceIdentifier.builder(NetworkTopology.class)
                .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
                .child(Node.class,nodeKey)
                .build();
    }
}
 
示例5
private void initializeOvsdbTopology(final LogicalDatastoreType type) {
    InstanceIdentifier<Topology> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
    ReadWriteTransaction transaction = db.newReadWriteTransaction();
    FluentFuture<Boolean> ovsdbTp = transaction.exists(type, path);
    try {
        if (!ovsdbTp.get().booleanValue()) {
            TopologyBuilder tpb = new TopologyBuilder();
            tpb.setTopologyId(SouthboundConstants.OVSDB_TOPOLOGY_ID);
            transaction.mergeParentStructurePut(type, path, tpb.build());
            transaction.commit();
        } else {
            transaction.cancel();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Error initializing ovsdb topology", e);
    }
}
 
示例6
private static OvsdbBridgeAugmentation getBridge(final InstanceIdentifier<OvsdbNodeAugmentation> key,
        final Uri bridgeUri) {
    final InstanceIdentifier<OvsdbBridgeAugmentation> bridgeIid = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class, new NodeKey(new NodeId(bridgeUri)))
            .augmentation(OvsdbBridgeAugmentation.class);

    OvsdbBridgeAugmentation bridge = null;
    try (ReadTransaction transaction = SouthboundProvider.getDb().newReadOnlyTransaction()) {
        final Optional<OvsdbBridgeAugmentation> bridgeOptional =
                transaction.read(LogicalDatastoreType.OPERATIONAL, bridgeIid).get();
        if (bridgeOptional.isPresent()) {
            bridge = bridgeOptional.get();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.warn("Error reading from datastore", e);
    }
    return bridge;
}
 
示例7
/**
 * Create the {@link InstanceIdentifier} for the {@link ControllerEntry}.
 *
 * @param controllerEntry the {@link ControllerEntry}
 * @param bridgeName the name of the bridge
 * @return the {@link InstanceIdentifier}
 */
@VisibleForTesting
InstanceIdentifier<ControllerEntry> getControllerEntryIid(
        final ControllerEntry controllerEntry, final String bridgeName) {

    OvsdbConnectionInstance client = getOvsdbConnectionInstance();
    String nodeString = client.getNodeKey().getNodeId().getValue()
            + "/bridge/" + bridgeName;
    NodeId nodeId = new NodeId(new Uri(nodeString));
    NodeKey nodeKey = new NodeKey(nodeId);
    InstanceIdentifier<Node> bridgeIid = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class,nodeKey)
            .build();

    return bridgeIid
            .augmentation(OvsdbBridgeAugmentation.class)
            .child(ControllerEntry.class, controllerEntry.key());
}
 
示例8
/**
 * Create the {@link InstanceIdentifier} for the {@link ManagerEntry}.
 *
 * @param managerEntry the {@link ManagerEntry}
 * @return the {@link InstanceIdentifier}
 */
private InstanceIdentifier<ManagerEntry> getManagerEntryIid(ManagerEntry managerEntry) {

    OvsdbConnectionInstance client = getOvsdbConnectionInstance();
    String nodeString = client.getNodeKey().getNodeId().getValue();
    NodeId nodeId = new NodeId(new Uri(nodeString));
    NodeKey nodeKey = new NodeKey(nodeId);
    InstanceIdentifier<Node> ovsdbNodeIid = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class,new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class,nodeKey)
            .build();

    return ovsdbNodeIid
            .augmentation(OvsdbNodeAugmentation.class)
            .child(ManagerEntry.class, managerEntry.key());
}
 
示例9
private Boolean getOvsdbTopology() {
    LOG.info("getOvsdbTopology: looking for {}...", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue());
    Boolean found = false;
    final TopologyId topologyId = SouthboundUtils.OVSDB_TOPOLOGY_ID;
    InstanceIdentifier<Topology> path =
            InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
    for (int i = 0; i < 60; i++) {
        Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
        if (topology != null) {
            LOG.info("getOvsdbTopology: found {}...", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue());
            found = true;
            break;
        } else {
            LOG.info("getOvsdbTopology: still looking ({})...", i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                LOG.warn("Interrupted while waiting for {}", SouthboundUtils.OVSDB_TOPOLOGY_ID.getValue(), e);
            }
        }
    }
    return found;
}
 
示例10
@Test
public void testGetOvsdbNodes() throws InterruptedException {
    ConnectionInfo connectionInfo = getConnectionInfo(addressStr, portNumber);
    InstanceIdentifier<Topology> topologyPath = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));

    Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, topologyPath);
    InstanceIdentifier<Node> expectedNodeIid = SouthboundUtils.createInstanceIdentifier(connectionInfo);
    NodeId expectedNodeId = expectedNodeIid.firstKeyOf(Node.class).getNodeId();
    Node foundNode = null;
    Assert.assertNotNull("Expected to find topology: " + topologyPath, topology);
    Assert.assertNotNull("Expected to find some nodes" + topology.getNode());
    LOG.info("expectedNodeId: {}, getNode: {}", expectedNodeId, topology.getNode());
    for (Node node : topology.nonnullNode().values()) {
        if (node.getNodeId().getValue().equals(expectedNodeId.getValue())) {
            foundNode = node;
            break;
        }
    }
    Assert.assertNotNull("Expected to find Node: " + expectedNodeId, foundNode);
}
 
示例11
private void initializeHwvtepTopology(final LogicalDatastoreType type) {
    InstanceIdentifier<Topology> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID));
    ReadWriteTransaction transaction = dataBroker.newReadWriteTransaction();
    FluentFuture<Boolean> hwvtepTp = transaction.exists(type, path);
    try {
        if (!hwvtepTp.get().booleanValue()) {
            TopologyBuilder tpb = new TopologyBuilder();
            tpb.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID);
            transaction.mergeParentStructurePut(type, path, tpb.build());
            transaction.commit();
        } else {
            transaction.cancel();
        }
    } catch (InterruptedException | ExecutionException e) {
        LOG.error("Error initializing hwvtep topology", e);
    }
}
 
示例12
private Boolean getHwvtepTopology() {
    LOG.info("getHwvtepTopology: looking for {}...", HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue());
    Boolean found = false;
    final TopologyId topologyId = HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID;
    InstanceIdentifier<Topology> path =
            InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
    for (int i = 0; i < 60; i++) {
        Boolean topology = mdsalUtils.exists(LogicalDatastoreType.OPERATIONAL, path);
        if (topology) {
            LOG.info("getHwvtepTopology: found {}...", HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue());
            found = true;
            break;
        } else {
            LOG.info("getHwvtepTopology: still looking ({})...", i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                LOG.warn("Interrupted while waiting for {}",
                        HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID.getValue(), e);
            }
        }
    }
    return found;
}
 
示例13
private boolean isNodeConnectorInternal(NodeConnector nodeConnector) {
	TpId tpId = new TpId(nodeConnector.getKey().getId().getValue());
	InstanceIdentifier<NetworkTopology> ntII = InstanceIdentifier.builder(NetworkTopology.class).build();
	ListenableFuture<Optional<NetworkTopology>> lfONT;
	try (ReadOnlyTransaction rot = dataService.newReadOnlyTransaction()) {
		lfONT = rot.read(LogicalDatastoreType.OPERATIONAL, ntII);
		rot.close();
	}
	Optional<NetworkTopology> oNT;
	try {
		oNT = lfONT.get();
	} catch (InterruptedException | ExecutionException ex) {
		LOG.warn(ex.getLocalizedMessage());
		return false;
	}
	if (oNT != null && oNT.isPresent()) {
		NetworkTopology networkTopo = oNT.get();
		for (Topology t : networkTopo.getTopology()) {
			if (t.getLink() != null) {
				for (Link l : t.getLink()) {
					if ((l.getSource().getSourceTp().equals(tpId)
							&& !l.getDestination().getDestTp().getValue().startsWith(Host.NODE_PREFIX))
							|| (l.getDestination().getDestTp().equals(tpId)
									&& !l.getSource().getSourceTp().getValue().startsWith(Host.NODE_PREFIX))) {
						return true;
					}
				}
			}
		}
	}
	return false;
}
 
示例14
TopologyDataChangeCounter(final DataBroker dataBroker, final String counterId, final String topologyName) {
    this.dataBroker = dataBroker;
    this.transactionChain = this.dataBroker.createMergingTransactionChain(this);
    this.counterId = counterId;
    this.counterInstanceId = InstanceIdentifier.builder(DataChangeCounter.class)
            .child(Counter.class, new CounterKey(this.counterId)).build();
    putCount(this.count.longValue());
    final InstanceIdentifier<Topology> topoIId = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(topologyName))).build();
    this.registration = this.dataBroker.registerDataTreeChangeListener(
        DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, topoIId), this);
    LOG.debug("Data change counter {} initiated", this.counterId);
}
 
示例15
@Override
public synchronized void instantiateServiceInstance() {
    LOG.info("Instantiate PCEP Tunnel Topology Provider Singleton Service {}", getIdentifier().getName());

    final InstanceIdentifier<Topology> topology = InstanceIdentifier
            .builder(NetworkTopology.class).child(Topology.class, new TopologyKey(this.tunnelTopologyId)).build();
    this.reg = this.dependencies.getRpcProviderRegistry()
            .registerRpcImplementation(TopologyTunnelPcepProgrammingService.class,
                    this.tp, Collections.singleton(topology));
    this.ttp.init();
}
 
示例16
public TunnelProviderDeployer(
        final DataBroker dataBroker,
        final RpcProviderService rpcProviderRegistry,
        final RpcConsumerRegistry rpcConsumerRegistry,
        final BundleContext bundleContext,
        final ClusterSingletonServiceProvider cssp
) {
    LOG.info("Creating Tunnel Provider Deployer");
    this.dependencies = new TunnelProviderDependencies(dataBroker, cssp, rpcProviderRegistry, rpcConsumerRegistry,
            bundleContext);
    this.networTopology = InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).build();
}
 
示例17
public PCEPTopologyDeployerImpl(final BlueprintContainer container,
        final DataBroker dataBroker, final InstructionSchedulerFactory instructionSchedulerFactory) {
    this.container = requireNonNull(container);
    this.dataBroker = requireNonNull(dataBroker);
    this.instructionSchedulerFactory = requireNonNull(instructionSchedulerFactory);
    this.networTopology = InstanceIdentifier.builder(NetworkTopology.class).build();
}
 
示例18
public PCEPTopologyConfiguration(final @NonNull SessionConfig config, final @NonNull Topology topology) {
    requireNonNull(topology);
    this.address = PCEPTopologyProviderUtil.getInetSocketAddress(requireNonNull(config.getListenAddress()),
            requireNonNull(config.getListenPort()));
    this.keys = requireNonNull(PCEPTopologyProviderUtil.contructKeys(topology));
    this.speakerIds = requireNonNull(PCEPTopologyProviderUtil.contructSpeakersId(topology));
    this.topologyId = requireNonNull(topology.getTopologyId());
    this.rpcTimeout = config.getRpcTimeout();
    this.topology = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(this.topologyId)).build();
}
 
示例19
public synchronized void init() {
    LOG.info("Initializing PCEP Topology Stats RPC service.");
    this.listenerRegistration = this.dataBroker.registerDataTreeChangeListener(
            DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
                    InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).child(Node.class)
                            .augmentation(PcepTopologyNodeStatsAug.class).child(PcepSessionState.class).build()),
            this);
}
 
示例20
private static Node readNodeFromDataStore(final DataBroker dataBroker,
        final String topologyId, final String nodeId) {
    final InstanceIdentifier<Node> topology = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(topologyId)))
            .child(Node.class, new NodeKey(new NodeId(nodeId))).build();

    final ReadTransaction rot = dataBroker.newReadOnlyTransaction();

    try {
        return rot.read(LogicalDatastoreType.OPERATIONAL, topology).get().orElse(null);
    } catch (final InterruptedException | ExecutionException e) {
        LOG.warn("Failed to read node {}", nodeId, e);
    }
    return null;
}
 
示例21
private void createDefaultProtocol() throws ExecutionException, InterruptedException {
    final WriteTransaction wt = getDataBroker().newWriteOnlyTransaction();
    final Node node = new NodeBuilder()
            .setNodeId(new NodeId(NODE_ID))
            .addAugmentation(new PcepTopologyNodeStatsAugBuilder().setPcepSessionState(createPcepSessionState())
                .build())
            .build();

    final InstanceIdentifier<Node> topology = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(PCEP_TOPOLOGY)))
            .child(Node.class, new NodeKey(new NodeId(NODE_ID))).build();
    wt.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, topology, node);
    wt.commit().get();
}
 
示例22
protected AbstractTopologyBuilder(final DataBroker dataProvider, final RibReference locRibReference,
        final TopologyId topologyId, final TopologyTypes types, final Class<? extends AddressFamily> afi,
    final Class<? extends SubsequentAddressFamily> safi, final long listenerResetLimitInMillsec,
    final int listenerResetEnforceCounter) {
    this.dataProvider = dataProvider;
    this.locRibReference = requireNonNull(locRibReference);
    this.topologyKey = new TopologyKey(requireNonNull(topologyId));
    this.topologyTypes = types;
    this.afi = afi;
    this.safi = safi;
    this.listenerResetLimitInMillsec = listenerResetLimitInMillsec;
    this.listenerResetEnforceCounter = listenerResetEnforceCounter;
    this.topology = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, this.topologyKey).build();
}
 
示例23
public MyRouterOrchestrator(BindingAwareBroker bindingAwareBroker, DataBroker dataBroker, NotificationProviderService notificationService, RpcProviderRegistry rpcProviderRegistry) {
    //Register this object as a provider for receiving session context
    bindingAwareBroker.registerProvider(this);
    
    //Register this object as listener for changes in netconf topology
    InstanceIdentifier<Topology> netconfTopoIID = InstanceIdentifier.builder(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(new TopologyId(TopologyNetconf.QNAME.getLocalName())))
            .build();
    registrations.add(dataBroker.registerDataChangeListener(LogicalDatastoreType.OPERATIONAL, netconfTopoIID.child(Node.class), this, DataChangeScope.SUBTREE));
}
 
示例24
public static InstanceIdentifier<Node> createInstanceIdentifier(IpAddress ip, PortNumber port) {
    InstanceIdentifier<Node> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID))
            .child(Node.class,createNodeKey(ip,port));
    LOG.debug("Created ovsdb path: {}",path);
    return path;
}
 
示例25
public InstanceIdentifier<TerminationPoint> createTerminationPointInstanceIdentifier(Node node, String portName) {

        InstanceIdentifier<TerminationPoint> terminationPointPath = InstanceIdentifier
                .create(NetworkTopology.class)
                .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID))
                .child(Node.class,node.key())
                .child(TerminationPoint.class, new TerminationPointKey(new TpId(portName)));

        LOG.debug("Termination point InstanceIdentifier generated : {}",terminationPointPath);
        return terminationPointPath;
    }
 
示例26
/**
 * Read the list of <code>OvsdbTerminationPointAugmentation</code> for the particular <code>node</code>.
 */
public List<OvsdbTerminationPointAugmentation> readTerminationPointAugmentations(Node node) {
    if (node == null) {
        LOG.error("readTerminationPointAugmentations: Node value is null");
        return Collections.emptyList();
    }
    Node operNode = provider.read(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(OVSDB_TOPOLOGY_ID))
            .child(Node.class, new NodeKey(node.getNodeId())));
    if (operNode != null) {
        return extractTerminationPointAugmentations(operNode);
    }
    return new ArrayList<>();
}
 
示例27
/**
 * Get all OVSDB nodes from topology.
 * @return a list of nodes or null if the topology could not found
 */
public Map<NodeKey, Node> getOvsdbNodes() {
    InstanceIdentifier<Topology> inst = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class,
            new TopologyKey(OVSDB_TOPOLOGY_ID));
    Topology topology = provider.read(LogicalDatastoreType.OPERATIONAL, inst);
    return topology != null ? topology.getNode() : null;
}
 
示例28
public static InstanceIdentifier<Node> createInstanceIdentifier(IpAddress ip, PortNumber port) {
    InstanceIdentifier<Node> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID))
            .child(Node.class,createNodeKey(ip,port));
    LOG.debug("Created hwvtep path: {}",path);
    return path;
}
 
示例29
/**
 * Used by blueprint when starting the container.
 */
@PostConstruct
public void init() {
    LOG.info("SouthboundProvider Session Initiated");
    ovsdbStatusProvider.reportStatus(ServiceState.STARTING, "OVSDB initialization in progress");
    this.txInvoker = new TransactionInvokerImpl(db);
    cm = new OvsdbConnectionManager(db, txInvoker, entityOwnershipService, ovsdbConnection,
            instanceIdentifierCodec, upgradeState);
    ovsdbDataTreeChangeListener = new OvsdbDataTreeChangeListener(db, cm, instanceIdentifierCodec);
    ovsdbOperGlobalListener = new OvsdbOperGlobalListener(db, cm, txInvoker);

    //Register listener for entityOnwership changes
    providerOwnershipChangeListener =
            new SouthboundPluginInstanceEntityOwnershipListener(this,this.entityOwnershipService);

    //register instance entity to get the ownership of the provider
    Entity instanceEntity = new Entity(ENTITY_TYPE, ENTITY_TYPE);
    try {
        registration = entityOwnershipService.registerCandidate(instanceEntity);
    } catch (CandidateAlreadyRegisteredException e) {
        LOG.warn("OVSDB Southbound Provider instance entity {} was already "
                + "registered for ownership", instanceEntity, e);
    }
    InstanceIdentifier<Topology> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
    DataTreeIdentifier<Topology> treeId =
            DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, path);

    LOG.trace("Registering listener for path {}", treeId);
    operTopologyRegistration = db.registerDataTreeChangeListener(treeId, this);
    ovsdbUpgradeStateListener = new OvsdbUpgradeStateListener(db, cm);
}
 
示例30
private InstanceIdentifier<Node> getWildcardPath() {
    InstanceIdentifier<Node> path = InstanceIdentifier
            .create(NetworkTopology.class)
            .child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
            .child(Node.class);
    return path;
}