本文整理汇总了Java中org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier类的典型用法代码示例。如果您正苦于以下问题:Java KeyedInstanceIdentifier类的具体用法?Java KeyedInstanceIdentifier怎么用?Java KeyedInstanceIdentifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
KeyedInstanceIdentifier类属于org.opendaylight.yangtools.yang.binding包,在下文中一共展示了KeyedInstanceIdentifier类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerEventSourceTest
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void registerEventSourceTest() throws Exception {
topicTestHelper();
Node nodeMock = mock(Node.class);
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
doReturn(nodeKey).when(nodeMock).getKey();
doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
doReturn(routedRpcRegistrationMock).when(rpcProviderRegistryMock).addRoutedRpcImplementation(EventSourceService.class, eventSourceMock);
doNothing().when(routedRpcRegistrationMock).registerPath(eq(NodeContext.class), any(KeyedInstanceIdentifier.class));
assertNotNull("Return value has not been created correctly.", eventSourceTopology.registerEventSource(eventSourceMock));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:15,代码来源:EventSourceTopologyTest.java
示例2: configFileTest
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的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();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:NetworkTopologyConfigFileProcessorTest.java
示例3: ensureNodePresent
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private InstanceIdentifier<IgpNodeAttributes> ensureNodePresent(final ReadWriteTransaction trans, final NodeId ni) {
final NodeUsage present = this.nodes.get(ni);
if (present != null) {
return present.attrId;
}
final KeyedInstanceIdentifier<Node, NodeKey> nii = nodeInstanceId(ni);
final InstanceIdentifier<IgpNodeAttributes> ret = nii.builder().augmentation(Node1.class)
.child(IgpNodeAttributes.class).build();
trans.merge(LogicalDatastoreType.OPERATIONAL, nii, new NodeBuilder().setKey(nii.getKey()).setNodeId(ni)
.addAugmentation(Node1.class, new Node1Builder().setIgpNodeAttributes(
new IgpNodeAttributesBuilder().setPrefix(Collections.emptyList()).build()).build()).build());
this.nodes.put(ni, new NodeUsage(ret));
return ret;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:AbstractReachabilityTopologyBuilder.java
示例4: storeOperationalState
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private synchronized void storeOperationalState(final BGPRIBState bgpStateConsumer,
final List<BGPPeerState> peerStats, final String ribId, final WriteTransaction wtx) {
final Global global = GlobalUtil.buildGlobal(bgpStateConsumer, this.bgpTableTypeRegistry);
final PeerGroups peerGroups = PeerGroupUtil.buildPeerGroups(peerStats);
final Neighbors neighbors = NeighborUtil.buildNeighbors(peerStats, this.bgpTableTypeRegistry);
InstanceIdentifier<Bgp> bgpIID = this.instanceIdentifiersCache.get(ribId);
if (bgpIID == null) {
final ProtocolKey protocolKey = new ProtocolKey(BGP.class, bgpStateConsumer.getInstanceIdentifier()
.getKey().getId().getValue());
final KeyedInstanceIdentifier<Protocol, ProtocolKey> protocolIId = this.networkInstanceIId
.child(Protocols.class).child(Protocol.class, protocolKey);
bgpIID = protocolIId.augmentation(Protocol1.class).child(Bgp.class);
this.instanceIdentifiersCache.put(ribId, bgpIID);
}
final Bgp bgp = new BgpBuilder().setGlobal(global).setNeighbors(neighbors).setPeerGroups(peerGroups).build();
wtx.put(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp, WriteTransaction.CREATE_MISSING_PARENTS);
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:19,代码来源:StateProviderImpl.java
示例5: createExpectedConfigurationChanges
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private Map<InstanceIdentifier<?>, DataObject> createExpectedConfigurationChanges(final Node bridgeNode) {
OvsdbBridgeAugmentation ovsdbBridge = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
Map<InstanceIdentifier<?>, DataObject> changes = new HashMap<>();
final InstanceIdentifier<Node> bridgeNodeIid =
SouthboundMapper.createInstanceIdentifier(bridgeNode.getNodeId());
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid =
bridgeNodeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
changes.put(bridgeNodeIid, bridgeNode);
changes.put(ovsdbBridgeIid, ovsdbBridge);
for (ProtocolEntry protocolEntry : ovsdbBridge.getProtocolEntry()) {
KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid =
ovsdbBridgeIid.child(ProtocolEntry.class, protocolEntry.getKey());
changes.put(protocolIid, protocolEntry);
}
for (ControllerEntry controller : ovsdbBridge.getControllerEntry()) {
KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid =
ovsdbBridgeIid.child(ControllerEntry.class, controller.getKey());
changes.put(controllerIid, controller);
}
return changes;
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:23,代码来源:BridgeConfigReconciliationTaskTest.java
示例6: testRemoveOldConfigs
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void testRemoveOldConfigs() throws Exception {
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
Map<String, String> oldOtherConfigs = new HashMap<>();
oldOtherConfigs.put("OpenvswitchOtherConfigsKey", "OpenvswitchOtherConfigsValue");
doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
//suppress getNodeId()
MemberModifier.suppress(
MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", OpenVSwitch.class));
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(mock(NodeKey.class));
OpenVSwitch ovs = mock(OpenVSwitch.class);
Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeOldConfigs",
transaction, oldOtherConfigs, ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:17,代码来源:OpenVSwitchUpdateCommandTest.java
示例7: testRemoveExternalIds
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void testRemoveExternalIds() throws Exception {
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
Map<String, String> oldExternalIds = new HashMap<>();
oldExternalIds.put("OpenvswitchExternalIdKey", "OpenvswitchExternalIdValue");
doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
//suppress getNodeId()
MemberModifier.suppress(
MemberMatcher.method(OpenVSwitchUpdateCommand.class, "getNodeId", OpenVSwitch.class));
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(mock(NodeKey.class));
OpenVSwitch ovs = mock(OpenVSwitch.class);
Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeExternalIds",
transaction, oldExternalIds, ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:17,代码来源:OpenVSwitchUpdateCommandTest.java
示例8: testGetManagerEntryIid
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void testGetManagerEntryIid() throws Exception {
ManagerEntry managerEntry = mock(ManagerEntry.class);
OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class, Mockito.RETURNS_DEEP_STUBS);
when(ovsdbManagersUpdateCommand.getOvsdbConnectionInstance()).thenReturn(client);
when(client.getNodeKey().getNodeId().getValue()).thenReturn(NODE_ID);
PowerMockito.whenNew(Uri.class).withAnyArguments().thenReturn(mock(Uri.class));
NodeId nodeId = mock(NodeId.class);
PowerMockito.whenNew(NodeId.class).withAnyArguments().thenReturn(nodeId);
NodeKey nodeKey = mock(NodeKey.class);
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(nodeKey);
when(managerEntry.getKey()).thenReturn(mock(ManagerEntryKey.class));
assertEquals(KeyedInstanceIdentifier.class,
Whitebox.invokeMethod(ovsdbManagersUpdateCommand, "getManagerEntryIid", managerEntry).getClass());
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:17,代码来源:OvsdbManagersUpdateCommandTest.java
示例9: testGetControllerEntryIid
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void testGetControllerEntryIid() throws Exception {
ControllerEntry controllerEntry = mock(ControllerEntry.class);
OvsdbConnectionInstance client = mock(OvsdbConnectionInstance.class);
when(ovsdbControllerUpdateCommand.getOvsdbConnectionInstance()).thenReturn(client);
NodeKey nodeKey = mock(NodeKey.class);
when(client.getNodeKey()).thenReturn(nodeKey);
NodeId nodeId = mock(NodeId.class);
when(nodeKey.getNodeId()).thenReturn(nodeId);
when(nodeId.getValue()).thenReturn(NODE_ID);
PowerMockito.whenNew(Uri.class).withAnyArguments().thenReturn(mock(Uri.class));
PowerMockito.whenNew(NodeId.class).withAnyArguments().thenReturn(nodeId);
PowerMockito.whenNew(NodeKey.class).withAnyArguments().thenReturn(nodeKey);
PowerMockito.whenNew(TopologyKey.class).withAnyArguments().thenReturn(mock(TopologyKey.class));
//PowerMockito.suppress(MemberMatcher.methodsDeclaredIn(InstanceIdentifier.class));
when(controllerEntry.getKey()).thenReturn(mock(ControllerEntryKey.class));
assertEquals(KeyedInstanceIdentifier.class, (Whitebox
.invokeMethod(ovsdbControllerUpdateCommand, "getControllerEntryIid", controllerEntry, BRIDGE_NAME)
.getClass()));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:21,代码来源:OvsdbControllerUpdateCommandTest.java
示例10: register
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
public void register(final EventSource eventSource){
final NodeKey nodeKey = eventSource.getSourceNodeKey();
final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
final RoutedRpcRegistration<EventSourceService> reg = rpcRegistry.addRoutedRpcImplementation(EventSourceService.class, eventSource);
reg.registerPath(NodeContext.class, sourcePath);
routedRpcRegistrations.put(nodeKey,reg);
insert(sourcePath);
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:11,代码来源:EventSourceTopology.java
示例11: unRegister
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
public void unRegister(final EventSource eventSource){
final NodeKey nodeKey = eventSource.getSourceNodeKey();
final KeyedInstanceIdentifier<Node, NodeKey> sourcePath = EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class, nodeKey);
final RoutedRpcRegistration<EventSourceService> removeRegistration = routedRpcRegistrations.remove(nodeKey);
if(removeRegistration != null){
removeRegistration.close();
remove(sourcePath);
}
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:10,代码来源:EventSourceTopology.java
示例12: registerTest
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Test
public void registerTest() throws Exception {
topicTestHelper();
Node nodeMock = mock(Node.class);
EventSource eventSourceMock = mock(EventSource.class);
NodeId nodeId = new NodeId("nodeIdValue1");
nodeKey = new NodeKey(nodeId);
doReturn(nodeKey).when(nodeMock).getKey();
doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(BindingAwareBroker.RoutedRpcRegistration.class);
doReturn(routedRpcRegistrationMock).when(rpcProviderRegistryMock).addRoutedRpcImplementation(EventSourceService.class, eventSourceMock);
doNothing().when(routedRpcRegistrationMock).registerPath(eq(NodeContext.class), any(KeyedInstanceIdentifier.class));
eventSourceTopology.register(eventSourceMock);
verify(routedRpcRegistrationMock, times(1)).registerPath(eq(NodeContext.class), any(KeyedInstanceIdentifier.class));
}
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:16,代码来源:EventSourceTopologyTest.java
示例13: getPolicyClassifierAceIdentifier
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private KeyedInstanceIdentifier<AceRule, AceRuleKey> getPolicyClassifierAceIdentifier(String policyClassifier,
String aclName, String ruleName) {
return InstanceIdentifier.create(PolicyProfiles.class)
.child(PolicyProfile.class, new PolicyProfileKey(policyClassifier))
.child(PolicyAclRule.class, new PolicyAclRuleKey(aclName))
.child(AceRule.class, new AceRuleKey(ruleName));
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:8,代码来源:PolicyServiceUtil.java
示例14: getVrfFromRd
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
/** get the vrf with the RouterDistinguisher pass in param.
* @param rd is the RouteDistinguisher of vrf
* @return the vrf of rd or null if no exist
*/
public Vrfs getVrfFromRd(String rd) {
Vrfs vrfs = null;
KeyedInstanceIdentifier<Vrfs, VrfsKey> id = InstanceIdentifier.create(Bgp.class)
.child(Vrfs.class, new VrfsKey(rd));
Optional<Vrfs> vrfsFromDs = MDSALUtil.read(dataBroker, LogicalDatastoreType.CONFIGURATION, id);
if (vrfsFromDs.isPresent()) {
vrfs = vrfsFromDs.get();
}
return vrfs;
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:15,代码来源:BgpUtil.java
示例15: retrieveMeterIdentifier
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private InstanceIdentifier<Meter> retrieveMeterIdentifier(final MeterId meterId, Node node) {
KeyedInstanceIdentifier<Meter, MeterKey> flowIID = null;
try {
final InstanceIdentifier<Node> nodePath = InstanceIdentifier
.create(Nodes.class)
.child(Node.class, node.getKey());
flowIID = nodePath
.augmentation(FlowCapableNode.class)
.child(Meter.class, new MeterKey(meterId));
} catch (Exception e) {
LOG.error(e.getMessage());
}
return flowIID.builder().build();
}
开发者ID:opendaylight,项目名称:nic,代码行数:16,代码来源:MeterExecutor.java
示例16: retrieveIpv4Identifier
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private InstanceIdentifier<Ipv4Routes> retrieveIpv4Identifier() {
final ApplicationRibKey applicationRibKey = new ApplicationRibKey(new ApplicationRibId(APPLICATION_RIB_ID));
final TablesKey tablesKey = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
final InstanceIdentifier tableIdentifier = KeyedInstanceIdentifier
.builder(ApplicationRib.class, applicationRibKey).child(Tables.class, tablesKey).build();
return tableIdentifier.child(Ipv4Routes.class);
}
开发者ID:opendaylight,项目名称:nic,代码行数:8,代码来源:BGPRendererServiceImpl.java
示例17: updatePcepStats
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private synchronized void updatePcepStats() {
final WriteTransaction tx = TopologyStatsProviderImpl.this.transactionChain.newWriteOnlyTransaction();
for (final Map.Entry<KeyedInstanceIdentifier<Node, NodeKey>, PcepSessionState> entry
: this.statsMap.entrySet()) {
final PcepTopologyNodeStatsAug nodeStatsAug = new PcepTopologyNodeStatsAugBuilder()
.setPcepSessionState(new PcepSessionStateBuilder(entry.getValue()).build()).build();
final InstanceIdentifier<PcepTopologyNodeStatsAug> statId =
entry.getKey().augmentation(PcepTopologyNodeStatsAug.class);
tx.put(LogicalDatastoreType.OPERATIONAL, statId, nodeStatsAug);
}
tx.submit();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:TopologyStatsProviderImpl.java
示例18: close
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Override
public synchronized void close() throws Exception {
LOG.info("Closing TopologyStatsProvider service.", this);
this.scheduleTask.cancel(true);
final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
for (final KeyedInstanceIdentifier<Node, NodeKey> statId : this.statsMap.keySet()) {
wTx.delete(LogicalDatastoreType.OPERATIONAL, statId);
wTx.submit().get();
}
this.statsMap.clear();
this.transactionChain.close();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:TopologyStatsProviderImpl.java
示例19: unbind
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
@Override
public synchronized void unbind(final KeyedInstanceIdentifier<Node, NodeKey> nodeId) {
this.statsMap.remove(nodeId);
final WriteTransaction wTx = this.transactionChain.newWriteOnlyTransaction();
wTx.delete(LogicalDatastoreType.OPERATIONAL, nodeId);
try {
wTx.submit().get();
} catch (final InterruptedException | ExecutionException e) {
LOG.warn("Failed to remove Pcep Node stats {}.", nodeId.getKey().getNodeId());
}
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:12,代码来源:TopologyStatsProviderImpl.java
示例20: updateBGPStats
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; //导入依赖的package包/类
private synchronized void updateBGPStats(final WriteTransaction wtx) {
final Set<String> oldStats = new HashSet<>(this.instanceIdentifiersCache.keySet());
this.stateCollector.getRibStats().stream().filter(BGPRIBState::isActive).forEach(bgpStateConsumer -> {
final KeyedInstanceIdentifier<Rib, RibKey> ribId = bgpStateConsumer.getInstanceIdentifier();
final List<BGPPeerState> peerStats = this.stateCollector.getPeerStats().stream()
.filter(BGPPeerState::isActive).filter(peerState -> ribId.equals(peerState.getInstanceIdentifier()))
.collect(Collectors.toList());
storeOperationalState(bgpStateConsumer, peerStats, ribId.getKey().getId().getValue(), wtx);
oldStats.remove(ribId.getKey().getId().getValue());
});
oldStats.forEach(ribId -> removeStoredOperationalState(ribId, wtx));
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:13,代码来源:StateProviderImpl.java
注:本文中的org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论