本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology类的典型用法代码示例。如果您正苦于以下问题:Java NetworkTopology类的具体用法?Java NetworkTopology怎么用?Java NetworkTopology使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkTopology类属于org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021包,在下文中一共展示了NetworkTopology类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findGWLink
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
private Link findGWLink(ReadWriteTransaction trans, FabricId fabricid, TpId tpid, NodeId routerid) {
InstanceIdentifier<Link> linkIId = InstanceIdentifier.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(new TopologyId(fabricid)))
.child(Link.class, new LinkKey(this.createGatewayLink(routerid, tpid)));
CheckedFuture<Optional<Link>,ReadFailedException> readFuture = trans.read(LogicalDatastoreType.OPERATIONAL,
linkIId);
try {
Optional<Link> optional = readFuture.get();
Link link = optional.get();
return link;
} catch (InterruptedException | ExecutionException e) {
LOG.error("", e);
}
return null;
}
示例2: testPutCreateParentsSuccess
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
@Test
public void testPutCreateParentsSuccess() throws Exception {
InstanceIdentifier<Node> iid = InstanceIdentifier.builder(NetworkTopology.class)
.child(Topology.class, new TopologyKey(new TopologyId("topology-netconf")))
.child(Node.class, new NodeKey(new NodeId(NODE_ID)))
.build();
Node node1 =
createNetconfNode(NODE_ID, V3PO_1704_CAPABILITY, V3PO_1701_CAPABILITY, INTERFACES);
WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.put(LogicalDatastoreType.OPERATIONAL, iid, node1, true);
writeTx.submit().get();
Assert.assertEquals(sf.get(), Integer.valueOf(1));
sf = SettableFuture.create();
writeTx = getDataBroker().newWriteOnlyTransaction();
writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
writeTx.submit().get();
Assert.assertEquals(sf.get(), Integer.valueOf(2));
}
示例3: configFileTest
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
@Test
public void configFileTest() throws ReadFailedException, InterruptedException {
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();
}
示例4: createTunnelTopologyProvider
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
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.getAugmentation(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);
}
示例5: getInstanceIdentifier
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
public static InstanceIdentifier<Node> getInstanceIdentifier(InstanceIdentifierCodec instanceIdentifierCodec,
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();
}
}
示例6: initializeOvsdbTopology
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
private void initializeOvsdbTopology(LogicalDatastoreType type) {
InstanceIdentifier<Topology> path = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID));
ReadWriteTransaction transaction = db.newReadWriteTransaction();
CheckedFuture<Optional<Topology>, ReadFailedException> ovsdbTp = transaction.read(type, path);
try {
if (!ovsdbTp.get().isPresent()) {
TopologyBuilder tpb = new TopologyBuilder();
tpb.setTopologyId(SouthboundConstants.OVSDB_TOPOLOGY_ID);
transaction.put(type, path, tpb.build(), true);
transaction.submit();
} else {
transaction.cancel();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error initializing ovsdb topology", e);
}
}
示例7: getBridge
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
private OvsdbBridgeAugmentation getBridge(InstanceIdentifier<OvsdbNodeAugmentation> key,
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 (ReadOnlyTransaction 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;
}
示例8: getControllerEntryIid
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
/**
* Create the {@link InstanceIdentifier} for the {@link ControllerEntry}.
*
* @param controllerEntry the {@link ControllerEntry}
* @param bridgeName the name of the bridge
* @return the {@link InstanceIdentifier}
*/
private InstanceIdentifier<ControllerEntry> getControllerEntryIid(
ControllerEntry controllerEntry, 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.getKey());
}
示例9: getManagerEntryIid
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
/**
* 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.getKey());
}
示例10: getOvsdbTopology
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
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;
}
示例11: testGetOvsdbNodes
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
@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.getNode()) {
if (node.getNodeId().getValue().equals(expectedNodeId.getValue())) {
foundNode = node;
break;
}
}
Assert.assertNotNull("Expected to find Node: " + expectedNodeId, foundNode);
}
示例12: initializeHwvtepTopology
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
private void initializeHwvtepTopology(LogicalDatastoreType type) {
InstanceIdentifier<Topology> path = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID));
ReadWriteTransaction transaction = db.newReadWriteTransaction();
CheckedFuture<Optional<Topology>, ReadFailedException> hwvtepTp = transaction.read(type, path);
try {
if (!hwvtepTp.get().isPresent()) {
TopologyBuilder tpb = new TopologyBuilder();
tpb.setTopologyId(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID);
transaction.put(type, path, tpb.build(), true);
transaction.submit();
} else {
transaction.cancel();
}
} catch (Exception e) {
LOG.error("Error initializing hwvtep topology", e);
}
}
示例13: getHwvtepTopology
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
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++) {
Topology topology = mdsalUtils.read(LogicalDatastoreType.OPERATIONAL, path);
if (topology != null) {
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;
}
示例14: getWildCardPath
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
@Override
protected InstanceIdentifier<RemoteMcastMacs> getWildCardPath() {
return InstanceIdentifier.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID))
.child(Node.class).augmentation(HwvtepGlobalAugmentation.class)
.child(RemoteMcastMacs.class);
}
示例15: initializeNetvirtTopology
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology; //导入依赖的package包/类
private void initializeNetvirtTopology() {
final TopologyId topologyId = new TopologyId("netvirt:1");
InstanceIdentifier<Topology> path =
InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(topologyId));
TopologyBuilder tpb = new TopologyBuilder();
tpb.setTopologyId(topologyId);
if (!put(LogicalDatastoreType.OPERATIONAL, path, tpb.build())) {
LOG.error("StateManager error initializing netvirt topology");
}
}