use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project controller by opendaylight.
the class ClusterAdminRpcServiceTest method testBackupDatastore.
@Test
public void testBackupDatastore() throws Exception {
MemberNode node = MemberNode.builder(memberNodes).akkaConfig("Member1").moduleShardsConfig("module-shards-member1.conf").waitForShardLeader("cars", "people").testName("testBackupDatastore").build();
String fileName = "target/testBackupDatastore";
new File(fileName).delete();
final ClusterAdminRpcService service = new ClusterAdminRpcService(node.configDataStore(), node.operDataStore(), null, null);
RpcResult<BackupDatastoreOutput> rpcResult = service.backupDatastore(new BackupDatastoreInputBuilder().setFilePath(fileName).build()).get(5, TimeUnit.SECONDS);
verifySuccessfulRpcResult(rpcResult);
try (FileInputStream fis = new FileInputStream(fileName)) {
List<DatastoreSnapshot> snapshots = SerializationUtils.deserialize(fis);
assertEquals("DatastoreSnapshot size", 2, snapshots.size());
ImmutableMap<String, DatastoreSnapshot> map = ImmutableMap.of(snapshots.get(0).getType(), snapshots.get(0), snapshots.get(1).getType(), snapshots.get(1));
verifyDatastoreSnapshot(node.configDataStore().getActorUtils().getDataStoreName(), map.get(node.configDataStore().getActorUtils().getDataStoreName()), "cars", "people");
} finally {
new File(fileName).delete();
}
// Test failure by killing a shard.
node.configDataStore().getActorUtils().getShardManager().tell(node.datastoreContextBuilder().shardInitializationTimeout(200, TimeUnit.MILLISECONDS).build(), ActorRef.noSender());
ActorRef carsShardActor = node.configDataStore().getActorUtils().findLocalShard("cars").get();
node.kit().watch(carsShardActor);
carsShardActor.tell(PoisonPill.getInstance(), ActorRef.noSender());
node.kit().expectTerminated(carsShardActor);
rpcResult = service.backupDatastore(new BackupDatastoreInputBuilder().setFilePath(fileName).build()).get(5, TimeUnit.SECONDS);
assertFalse("isSuccessful", rpcResult.isSuccessful());
assertEquals("getErrors", 1, rpcResult.getErrors().size());
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.
the class ElanServiceProvider method handleExternalElanNetwork.
private void handleExternalElanNetwork(ElanInstance elanInstance, boolean update, BiFunction<ElanInstance, String, Void> function) {
String elanInstanceName = elanInstance.getElanInstanceName();
boolean isFlatOrVlanNetwork = (ElanUtils.isFlat(elanInstance) || ElanUtils.isVlan(elanInstance));
if (!isFlatOrVlanNetwork) {
LOG.error("Network is not of type FLAT/VLAN." + "Ignoring Elan-interface creation for given ProviderInterface {}", elanInstance.getPhysicalNetworkName());
return;
}
if (elanInstance.getPhysicalNetworkName() == null) {
LOG.trace("No physical network attached to {}", elanInstanceName);
return;
}
Map<NodeKey, Node> nodes = southboundUtils.getOvsdbNodes();
if (nodes == null || nodes.isEmpty()) {
LOG.trace("No OVS nodes found while creating external network for ELAN {}", elanInstance.getElanInstanceName());
return;
}
for (Node node : nodes.values()) {
if (bridgeMgr.isIntegrationBridge(node)) {
if (update && !elanInstance.isExternal()) {
DpnInterfaces dpnInterfaces = elanUtils.getElanInterfaceInfoByElanDpn(elanInstanceName, bridgeMgr.getDatapathId(node));
if (dpnInterfaces == null || dpnInterfaces.getInterfaces().isEmpty()) {
continue;
}
}
String interfaceName = bridgeMgr.getProviderInterfaceName(node, elanInstance.getPhysicalNetworkName());
function.apply(elanInstance, interfaceName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.
the class HwvtepHAUtil method convertLocatorRef.
/**
* Trnaform locator reference to nodepath passed .
*
* @param src {@link HwvtepPhysicalLocatorRef} Logical Switch Ref which needs to be transformed
* @param nodePath {@link InstanceIdentifier} src needs to be transformed to this path
* @return physicalLocatorRef {@link HwvtepPhysicalLocatorRef} the transforrmed result
*/
public static HwvtepPhysicalLocatorRef convertLocatorRef(HwvtepPhysicalLocatorRef src, InstanceIdentifier<Node> nodePath) {
InstanceIdentifier<TerminationPoint> srcTepPath = (InstanceIdentifier<TerminationPoint>) src.getValue();
TpId tpId = srcTepPath.firstKeyOf(TerminationPoint.class).getTpId();
InstanceIdentifier<TerminationPoint> tpPath = nodePath.child(TerminationPoint.class, new TerminationPointKey(tpId));
HwvtepPhysicalLocatorRef physicalLocatorRef = new HwvtepPhysicalLocatorRef(tpPath);
return physicalLocatorRef;
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.
the class HwvtepHAUtil method convertLogicalSwitchRef.
/**
* Trnaform logical switch to nodepath passed .
*
* @param src {@link HwvtepLogicalSwitchRef} Logical Switch Ref which needs to be transformed
* @param nodePath {@link InstanceIdentifier} src needs to be transformed to this path
* @return ref {@link HwvtepLogicalSwitchRef} the transforrmed result
*/
public static HwvtepLogicalSwitchRef convertLogicalSwitchRef(HwvtepLogicalSwitchRef src, InstanceIdentifier<Node> nodePath) {
InstanceIdentifier<LogicalSwitches> srcId = (InstanceIdentifier<LogicalSwitches>) src.getValue();
HwvtepNodeName switchName = srcId.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName();
InstanceIdentifier<LogicalSwitches> iid = nodePath.augmentation(HwvtepGlobalAugmentation.class).child(LogicalSwitches.class, new LogicalSwitchesKey(switchName));
HwvtepLogicalSwitchRef ref = new HwvtepLogicalSwitchRef(iid);
return ref;
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.node.data.Node in project netvirt by opendaylight.
the class HwvtepHAUtil method buildManagersForHANode.
/**
* Transform child managers (Source) to HA managers using HA node path.
*
* @param childNode Child Node
* @param haGlobalCfg HA global config node
* @return Transformed managers
*/
public static List<Managers> buildManagersForHANode(Node childNode, Optional<Node> haGlobalCfg) {
Set<NodeId> nodeIds = new HashSet<>();
nodeIds.add(childNode.getNodeId());
List<NodeId> childNodeIds = getChildNodeIdsFromManagerOtherConfig(haGlobalCfg);
nodeIds.addAll(childNodeIds);
InstanceIdentifier<Node> parentIid = HwvtepHACache.getInstance().getParent(convertToInstanceIdentifier(childNode.getNodeId().getValue()));
HwvtepHACache.getInstance().getChildrenForHANode(parentIid).stream().forEach(iid -> nodeIds.add(iid.firstKeyOf(Node.class).getNodeId()));
ManagersBuilder builder1 = new ManagersBuilder();
builder1.withKey(new ManagersKey(new Uri(MANAGER_KEY)));
List<ManagerOtherConfigs> otherConfigses = new ArrayList<>();
String children = nodeIds.stream().map(NodeId::getValue).collect(Collectors.joining(","));
otherConfigses.add(getOtherConfigBuilder(HA_CHILDREN, children).build());
builder1.setManagerOtherConfigs(otherConfigses);
List<Managers> managers = new ArrayList<>();
managers.add(builder1.build());
return managers;
}
Aggregations