Java源码示例:org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier
示例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 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().withKey(nii.getKey()).setNodeId(ni)
.addAugmentation(new Node1Builder().setIgpNodeAttributes(
new IgpNodeAttributesBuilder().setPrefix(Collections.emptyList()).build()).build()).build());
this.nodes.put(ni, new NodeUsage(ret));
return ret;
}
示例3
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(NetworkInstanceProtocol.class).child(Bgp.class);
this.instanceIdentifiersCache.put(ribId, bgpIID);
}
final Bgp bgp = new BgpBuilder().setGlobal(global).setNeighbors(neighbors).setPeerGroups(peerGroups).build();
wtx.mergeParentStructurePut(LogicalDatastoreType.OPERATIONAL, bgpIID, bgp);
}
示例4
private LocRibWriter(final RIBSupport<C, S, R, I> ribSupport,
final TransactionChain chain,
final KeyedInstanceIdentifier<Rib, RibKey> ribIId,
final Uint32 ourAs,
final DataBroker dataBroker,
final BGPRibRoutingPolicy ribPolicies,
final BGPPeerTracker peerTracker,
final Class<? extends AfiSafiType> afiSafiType,
final PathSelectionMode pathSelectionMode) {
this.chain = requireNonNull(chain);
this.ribIId = requireNonNull(ribIId);
this.ribSupport = requireNonNull(ribSupport);
this.locRibTableIID = ribIId.child(LocRib.class).child(Tables.class, ribSupport.getTablesKey());
this.ourAs = ourAs.toJava();
this.dataBroker = requireNonNull(dataBroker);
this.peerTracker = peerTracker;
this.pathSelectionMode = pathSelectionMode;
this.entryDep = new RouteEntryDependenciesContainerImpl(this.ribSupport, this.peerTracker, ribPolicies,
afiSafiType, this.locRibTableIID);
init();
}
示例5
private void updateLocRib(final List<AdvertizedRoute<C, S, R, I>> newRoutes,
final List<StaleBestPathRoute<C, S, R, I>> staleRoutes,
final WriteTransaction tx) {
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = this.entryDep.getLocRibTableTarget();
for (final StaleBestPathRoute<C, S, R, I> staleContainer : staleRoutes) {
for (final I routeId : staleContainer.getStaleRouteKeyIdentifiers()) {
final InstanceIdentifier<R> routeTarget = ribSupport.createRouteIdentifier(locRibTarget, routeId);
LOG.debug("Delete route from LocRib {}", routeTarget);
tx.delete(LogicalDatastoreType.OPERATIONAL, routeTarget);
}
}
for (final AdvertizedRoute<C,S,R,I> advRoute : newRoutes) {
final R route = advRoute.getRoute();
final I iid = advRoute.getAddPathRouteKeyIdentifier();
final InstanceIdentifier<R> locRibRouteTarget
= this.ribSupport.createRouteIdentifier(locRibTarget, iid);
LOG.debug("Write route to LocRib {}", route);
tx.put(LogicalDatastoreType.OPERATIONAL, locRibRouteTarget, route);
}
}
示例6
private <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>> void storeRoute(
final RIBSupport<C, S, R, I> ribSupport, final boolean addPathSupported,
final KeyedInstanceIdentifier<Tables, TablesKey> tableRibout,
final RouteKeyIdentifier<R, I> advRoute, final R route, final Attributes effAttr,
final WriteTransaction tx) {
final InstanceIdentifier<R> ribOut;
final I newKey;
if (!addPathSupported) {
ribOut = ribSupport.createRouteIdentifier(tableRibout, advRoute.getNonAddPathRouteKeyIdentifier());
newKey = ribSupport.createRouteListKey(route.getRouteKey());
} else {
ribOut = ribSupport.createRouteIdentifier(tableRibout, advRoute.getAddPathRouteKeyIdentifier());
newKey = ribSupport.createRouteListKey(route.getPathId(), route.getRouteKey());
}
final R newRoute = ribSupport.createRoute(route, newKey, effAttr);
LOG.debug("Write advRoute {} to peer AdjRibsOut {}", advRoute, getPeerId());
tx.put(LogicalDatastoreType.OPERATIONAL, ribOut, newRoute);
}
示例7
private Map<InstanceIdentifier<?>, DataObject> createExpectedConfigurationChanges(final Node bridgeNode) {
OvsdbBridgeAugmentation ovsdbBridge = bridgeNode.augmentation(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().values()) {
KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid =
ovsdbBridgeIid.child(ProtocolEntry.class, protocolEntry.key());
changes.put(protocolIid, protocolEntry);
}
for (ControllerEntry controller : ovsdbBridge.getControllerEntry().values()) {
KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid =
ovsdbBridgeIid.child(ControllerEntry.class, controller.key());
changes.put(controllerIid, controller);
}
return changes;
}
示例8
@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.key()).thenReturn(mock(ManagerEntryKey.class));
assertEquals(KeyedInstanceIdentifier.class,
Whitebox.invokeMethod(ovsdbManagersUpdateCommand, "getManagerEntryIid", managerEntry).getClass());
}
示例9
@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.key()).thenReturn(mock(ControllerEntryKey.class));
assertEquals(KeyedInstanceIdentifier.class, Whitebox
.invokeMethod(ovsdbControllerUpdateCommand, "getControllerEntryIid", controllerEntry, BRIDGE_NAME)
.getClass());
}
示例10
@SuppressWarnings("checkstyle:IllegalCatch")
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
private synchronized void updatePcepStats() {
final WriteTransaction tx = TopologyStatsProviderImpl.this.transactionChain.newWriteOnlyTransaction();
try {
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.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
public void onSuccess(final CommitInfo result) {
LOG.debug("Successfully committed Topology stats update");
}
@Override
public void onFailure(final Throwable ex) {
LOG.error("Failed to commit Topology stats update", ex);
}
}, MoreExecutors.directExecutor());
} catch (final Exception e) {
LOG.warn("Failed to prepare Tx for PCEP stats update", e);
tx.cancel();
}
}
示例11
@Override
public synchronized void close() throws Exception {
if (closed.compareAndSet(false, true)) {
LOG.info("Closing TopologyStatsProvider service.");
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.commit().get();
this.statsMap.clear();
this.transactionChain.close();
this.scheduler.shutdown();
}
}
示例12
@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.commit().get();
} catch (final InterruptedException | ExecutionException e) {
LOG.warn("Failed to remove Pcep Node stats {}.", nodeId.getKey().getNodeId(), e);
}
}
示例13
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
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));
}
示例14
public static <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>>
LocRibWriter<C, S, R, I> create(
final @NonNull RIBSupport<C, S, R, I> ribSupport,
final @NonNull Class<? extends AfiSafiType> afiSafiType,
final @NonNull TransactionChain chain,
final @NonNull KeyedInstanceIdentifier<Rib, RibKey> ribIId,
final @NonNull AsNumber ourAs,
final @NonNull DataBroker dataBroker,
final BGPRibRoutingPolicy ribPolicies,
final @NonNull BGPPeerTracker peerTracker,
final @NonNull PathSelectionMode pathSelectionStrategy) {
return new LocRibWriter<>(ribSupport, chain, ribIId, ourAs.getValue(), dataBroker, ribPolicies,
peerTracker, afiSafiType, pathSelectionStrategy);
}
示例15
@SuppressWarnings("unchecked")
private Map<RouteUpdateKey, RouteEntry<C, S, R, I>> update(final WriteTransaction tx,
final Collection<DataTreeModification<Tables>> changes) {
final Map<RouteUpdateKey, RouteEntry<C, S, R, I>> ret = new HashMap<>();
for (final DataTreeModification<Tables> tc : changes) {
final DataObjectModification<Tables> table = tc.getRootNode();
final DataTreeIdentifier<Tables> rootPath = tc.getRootPath();
final KeyedInstanceIdentifier<Peer, PeerKey> peerKIid = (KeyedInstanceIdentifier<Peer, PeerKey>)
rootPath.getRootIdentifier().firstIdentifierOf(Peer.class);
final RouterId peerUuid = RouterId.forPeerId(peerKIid.getKey().getPeerId());
/*
Initialize Peer with routes under loc rib
*/
if (!this.routeEntries.isEmpty() && table.getDataBefore() == null) {
final org.opendaylight.protocol.bgp.rib.spi.Peer toPeer
= this.peerTracker.getPeer(peerUuid.getPeerId());
if (toPeer != null && toPeer.supportsTable(this.entryDep.getLocalTablesKey())) {
LOG.debug("Peer {} table has been created, inserting existent routes", toPeer.getPeerId());
final List<ActualBestPathRoutes<C, S, R, I>> routesToStore = new ArrayList<>();
for (final Entry<String, RouteEntry<C, S, R, I>> entry : this.routeEntries.entrySet()) {
final List<ActualBestPathRoutes<C, S, R, I>> filteredRoute = entry.getValue()
.actualBestPaths(this.ribSupport, new RouteEntryInfoImpl(toPeer, entry.getKey()));
routesToStore.addAll(filteredRoute);
}
toPeer.initializeRibOut(this.entryDep, routesToStore);
}
}
/*
Process new routes from Peer
*/
updateNodes(table, peerUuid, tx, ret);
}
return ret;
}
示例16
public BGPPeerStateImpl(final @NonNull KeyedInstanceIdentifier<Rib, RibKey> instanceIdentifier,
final @Nullable String groupId, final @NonNull IpAddressNoZone neighborAddress,
final @NonNull Set<TablesKey> afiSafisAdvertized,
final @NonNull Set<TablesKey> afiSafisGracefulAdvertized,
final @NonNull Map<TablesKey, Integer> afiSafisLlGracefulAdvertized) {
super(instanceIdentifier);
this.neighborAddress = requireNonNull(neighborAddress);
this.groupId = groupId;
this.afiSafisAdvertized = requireNonNull(afiSafisAdvertized);
this.afiSafisGracefulAdvertized = requireNonNull(afiSafisGracefulAdvertized);
this.afiSafisLlGracefulAdvertised = requireNonNull(afiSafisLlGracefulAdvertized);
}
示例17
private synchronized <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
R extends Route & ChildOf<? super S> & Identifiable<I>,
I extends Identifier<R>> void deleteRouteRibOut(
final RIBSupport<C, S, R, I> ribSupport,
final List<StaleBestPathRoute<C, S, R, I>> staleRoutesIid,
final WriteTransaction tx) {
final TablesKey tk = ribSupport.getTablesKey();
final KeyedInstanceIdentifier<Tables, TablesKey> tableRibout = getRibOutIId(tk);
final boolean addPathSupported = supportsAddPathSupported(tk);
staleRoutesIid.forEach(staleRouteIid
-> removeRoute(ribSupport, addPathSupported, tableRibout, staleRouteIid, tx));
}
示例18
private <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>> void deleteRoute(
final RIBSupport<C, S, R, I> ribSupport, final boolean addPathSupported,
final KeyedInstanceIdentifier<Tables, TablesKey> tableRibout,
final AbstractAdvertizedRoute<C, S , R, I> advRoute, final WriteTransaction tx) {
final InstanceIdentifier<R> ribOutTarget = ribSupport.createRouteIdentifier(tableRibout,
addPathSupported ? advRoute.getAddPathRouteKeyIdentifier() : advRoute.getNonAddPathRouteKeyIdentifier());
LOG.trace("Removing {} from transaction for peer {}", ribOutTarget, getPeerId());
tx.delete(LogicalDatastoreType.OPERATIONAL, ribOutTarget);
}
示例19
RouteEntryDependenciesContainerImpl(
final RIBSupport<?, ?, ?, ?> ribSupport,
final BGPPeerTracker peerTracker,
final BGPRibRoutingPolicy routingPolicies,
final Class<? extends AfiSafiType> afiSafiType,
final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget) {
this.ribSupport = requireNonNull(ribSupport);
this.peerTracker = requireNonNull(peerTracker);
this.afiSafiType = requireNonNull(afiSafiType);
this.routingPolicies = requireNonNull(routingPolicies);
this.locRibTarget = requireNonNull(locRibTarget);
}
示例20
ProgrammingServiceImpl(final DataBroker dataProvider, final NotificationPublishService notifs,
final ListeningExecutorService executor, final RpcProviderService rpcProviderRegistry,
final ClusterSingletonServiceProvider cssp, final Timer timer, final String instructionId) {
this.dataProvider = requireNonNull(dataProvider);
this.instructionId = requireNonNull(instructionId);
this.notifs = requireNonNull(notifs);
this.executor = requireNonNull(executor);
this.rpcProviderRegistry = requireNonNull(rpcProviderRegistry);
this.timer = requireNonNull(timer);
this.qid = KeyedInstanceIdentifier.builder(InstructionsQueue.class,
new InstructionsQueueKey(this.instructionId)).build();
this.sgi = ServiceGroupIdentifier.create(this.instructionId + "-service-group");
LOG.info("Creating Programming Service {}.", this.sgi.getName());
this.csspReg = cssp.registerClusterSingletonService(this);
}
示例21
private static Map<InstanceIdentifier<?>, DataObject> extractBridgeConfigurationChanges(
final Node bridgeNode, final OvsdbBridgeAugmentation ovsdbBridge) {
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);
final Map<ProtocolEntryKey, ProtocolEntry> protocols = ovsdbBridge.getProtocolEntry();
if (protocols != null) {
for (ProtocolEntry protocol : protocols.values()) {
if (SouthboundConstants.OVSDB_PROTOCOL_MAP.get(protocol.getProtocol()) != null) {
KeyedInstanceIdentifier<ProtocolEntry, ProtocolEntryKey> protocolIid =
ovsdbBridgeIid.child(ProtocolEntry.class, protocol.key());
changes.put(protocolIid, protocol);
} else {
throw new IllegalArgumentException("Unknown protocol " + protocol.getProtocol());
}
}
}
final Map<ControllerEntryKey, ControllerEntry> controllers = ovsdbBridge.getControllerEntry();
if (controllers != null) {
for (ControllerEntry controller : controllers.values()) {
KeyedInstanceIdentifier<ControllerEntry, ControllerEntryKey> controllerIid =
ovsdbBridgeIid.child(ControllerEntry.class, controller.key());
changes.put(controllerIid, controller);
}
}
return changes;
}
示例22
@VisibleForTesting
void removeOldConfigs(ReadWriteTransaction transaction, Map<String, String> oldOtherConfigs, OpenVSwitch ovs) {
InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
.child(Node.class, new NodeKey(getNodeId(ovs)))
.augmentation(OvsdbNodeAugmentation.class);
Set<String> otherConfigKeys = oldOtherConfigs.keySet();
for (String otherConfigKey : otherConfigKeys) {
KeyedInstanceIdentifier<OpenvswitchOtherConfigs, OpenvswitchOtherConfigsKey> externalIid =
nodeAugmentataionIid
.child(OpenvswitchOtherConfigs.class, new OpenvswitchOtherConfigsKey(otherConfigKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIid);
}
}
示例23
@VisibleForTesting
void removeExternalIds(ReadWriteTransaction transaction, Map<String, String> oldExternalIds, OpenVSwitch ovs) {
InstanceIdentifier<OvsdbNodeAugmentation> nodeAugmentataionIid = InstanceIdentifier
.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(SouthboundConstants.OVSDB_TOPOLOGY_ID))
.child(Node.class, new NodeKey(getNodeId(ovs)))
.augmentation(OvsdbNodeAugmentation.class);
Set<String> externalIdKeys = oldExternalIds.keySet();
for (String externalIdKey : externalIdKeys) {
KeyedInstanceIdentifier<OpenvswitchExternalIds, OpenvswitchExternalIdsKey> externalIid =
nodeAugmentataionIid
.child(OpenvswitchExternalIds.class, new OpenvswitchExternalIdsKey(externalIdKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIid);
}
}
示例24
private void removeOldConfigs(ReadWriteTransaction transaction,
QueuesBuilder queuesBuilder, Map<String, String> oldOtherConfigs,
Queue queue, InstanceIdentifier<Node> nodeIId) {
InstanceIdentifier<Queues> queueIId = nodeIId
.augmentation(OvsdbNodeAugmentation.class)
.child(Queues.class, queuesBuilder.build().key());
Set<String> otherConfigKeys = oldOtherConfigs.keySet();
for (String otherConfigKey : otherConfigKeys) {
KeyedInstanceIdentifier<QueuesOtherConfig, QueuesOtherConfigKey> otherIId =
queueIId
.child(QueuesOtherConfig.class, new QueuesOtherConfigKey(otherConfigKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId);
}
}
示例25
private void removeOldExternalIds(ReadWriteTransaction transaction,
QueuesBuilder queuesBuilder, Map<String, String> oldExternalIds,
Queue queue, InstanceIdentifier<Node> nodeIId) {
InstanceIdentifier<Queues> queueIId = nodeIId
.augmentation(OvsdbNodeAugmentation.class)
.child(Queues.class, queuesBuilder.build().key());
Set<String> externalIdsKeys = oldExternalIds.keySet();
for (String extIdKey : externalIdsKeys) {
KeyedInstanceIdentifier<QueuesExternalIds, QueuesExternalIdsKey> externalIId =
queueIId
.child(QueuesExternalIds.class, new QueuesExternalIdsKey(extIdKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId);
}
}
示例26
private void removeOldConfigs(ReadWriteTransaction transaction,
QosEntriesBuilder qosEntryBuilder, Map<String, String> oldOtherConfigs,
Qos qos, InstanceIdentifier<Node> nodeIId) {
InstanceIdentifier<QosEntries> qosIId = nodeIId
.augmentation(OvsdbNodeAugmentation.class)
.child(QosEntries.class, qosEntryBuilder.build().key());
Set<String> otherConfigKeys = oldOtherConfigs.keySet();
for (String otherConfigKey : otherConfigKeys) {
KeyedInstanceIdentifier<QosOtherConfig, QosOtherConfigKey> otherIId =
qosIId
.child(QosOtherConfig.class, new QosOtherConfigKey(otherConfigKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId);
}
}
示例27
private void removeOldExternalIds(ReadWriteTransaction transaction,
QosEntriesBuilder qosEntryBuilder, Map<String, String> oldExternalIds,
Qos qos, InstanceIdentifier<Node> nodeIId) {
InstanceIdentifier<QosEntries> qosIId = nodeIId
.augmentation(OvsdbNodeAugmentation.class)
.child(QosEntries.class, qosEntryBuilder.build().key());
Set<String> externalIdsKeys = oldExternalIds.keySet();
for (String extIdKey : externalIdsKeys) {
KeyedInstanceIdentifier<QosExternalIds, QosExternalIdsKey> externalIId =
qosIId
.child(QosExternalIds.class, new QosExternalIdsKey(extIdKey));
transaction.delete(LogicalDatastoreType.OPERATIONAL, externalIId);
}
}
示例28
private void removeOldQueues(ReadWriteTransaction transaction,
QosEntriesBuilder qosEntryBuilder, Map<Long, UUID> oldQueueList,
Qos qos, InstanceIdentifier<Node> nodeIId) {
InstanceIdentifier<QosEntries> qosIId = nodeIId
.augmentation(OvsdbNodeAugmentation.class)
.child(QosEntries.class, qosEntryBuilder.build().key());
Collection<Long> queueListKeys = oldQueueList.keySet();
for (Long queueListKey : queueListKeys) {
KeyedInstanceIdentifier<QueueList, QueueListKey> otherIId =
qosIId.child(QueueList.class, new QueueListKey(Long.valueOf(queueListKey.toString())));
transaction.delete(LogicalDatastoreType.OPERATIONAL, otherIId);
}
}
示例29
@Test
public void testRemoveOldConfigs() throws Exception {
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
//suppress getNodeId()
doReturn(null).when(openVSwitchUpdateCommand).getNodeId(any());
OpenVSwitch ovs = mock(OpenVSwitch.class);
Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeOldConfigs",
transaction, ImmutableMap.of("OpenvswitchOtherConfigsKey", "OpenvswitchOtherConfigsValue"), ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}
示例30
@Test
public void testRemoveExternalIds() throws Exception {
ReadWriteTransaction transaction = mock(ReadWriteTransaction.class);
doNothing().when(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
//suppress getNodeId()
OpenVSwitch ovs = mock(OpenVSwitch.class);
doReturn(mock(NodeId.class)).when(openVSwitchUpdateCommand).getNodeId(any());
Whitebox.invokeMethod(openVSwitchUpdateCommand, "removeExternalIds",
transaction, ImmutableMap.of("OpenvswitchExternalIdKey", "OpenvswitchExternalIdValue"), ovs);
verify(transaction).delete(any(LogicalDatastoreType.class), any(KeyedInstanceIdentifier.class));
}