use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.topology.data.TopologyKey in project bgpcep by opendaylight.
the class ServerSessionManager method instantiateServiceInstance.
/**
* Create Base Topology.
*/
synchronized void instantiateServiceInstance() {
final TopologyKey key = InstanceIdentifier.keyOf(this.topology);
final TopologyId topologyId = key.getTopologyId();
final WriteTransaction tx = this.dependenciesProvider.getDataBroker().newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, this.topology, new TopologyBuilder().setKey(key).setTopologyId(topologyId).setTopologyTypes(new TopologyTypesBuilder().addAugmentation(TopologyTypes1.class, new TopologyTypes1Builder().setTopologyPcep(new TopologyPcepBuilder().build()).build()).build()).setNode(new ArrayList<>()).build(), true);
try {
tx.submit().get();
LOG.info("PCEP Topology {} created successfully.", topologyId.getValue());
ServerSessionManager.this.isClosed.set(false);
} catch (final ExecutionException | InterruptedException throwable) {
LOG.error("Failed to create PCEP Topology {}.", topologyId.getValue(), throwable);
ServerSessionManager.this.isClosed.set(true);
}
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.topology.data.TopologyKey in project genius by opendaylight.
the class HwvtepHACacheTest method newNodeInstanceIdentifier.
public static InstanceIdentifier<Node> newNodeInstanceIdentifier(String id) {
String nodeString = "hwvtep://uuid/" + java.util.UUID.nameUUIDFromBytes(id.getBytes()).toString();
NodeId nodeId = new NodeId(new Uri(nodeString));
NodeKey nodeKey = new NodeKey(nodeId);
TopologyKey topoKey = new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID);
return InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, topoKey).child(Node.class, nodeKey).build();
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.topology.data.TopologyKey in project netvirt by opendaylight.
the class QosTerminationPointListener method setPortBandwidthRule.
private void setPortBandwidthRule(InstanceIdentifier<OvsdbTerminationPointAugmentation> identifier, OvsdbTerminationPointAugmentation update, Port port) {
QosPolicy qosPolicy = qosNeutronUtils.getQosPolicy(port);
if (qosPolicy == null || qosPolicy.getBandwidthLimitRules() == null || qosPolicy.getBandwidthLimitRules().isEmpty()) {
return;
}
LOG.debug("setting bandwidth rule for port: {}, {}, qos policy: {}", port.getUuid(), update.getName(), qosPolicy.getName());
jobCoordinator.enqueueJob("QosPort-" + port.getUuid(), () -> Collections.singletonList(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
BandwidthLimitRules bwRule = qosPolicy.getBandwidthLimitRules().get(0);
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
tpAugmentationBuilder.setName(update.getName());
tpAugmentationBuilder.setIngressPolicingRate(bwRule.getMaxKbps().longValue());
tpAugmentationBuilder.setIngressPolicingBurst(bwRule.getMaxBurstKbps().longValue());
tx.mergeParentStructureMerge(InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, identifier.firstKeyOf(Node.class)).child(TerminationPoint.class, identifier.firstKeyOf(TerminationPoint.class)).augmentation(OvsdbTerminationPointAugmentation.class), tpAugmentationBuilder.build());
})));
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.topology.data.TopologyKey in project netvirt by opendaylight.
the class QosNeutronUtils method setPortBandwidthLimits.
// TODO Clean up the exception handling
@SuppressWarnings("checkstyle:IllegalCatch")
public void setPortBandwidthLimits(Port port, BandwidthLimitRules bwLimit, TypedWriteTransaction<Configuration> writeConfigTxn) {
if (!qosEosHandler.isQosClusterOwner()) {
LOG.debug("Not Qos Cluster Owner. Ignoring setting bandwidth limits");
return;
}
Uint64 dpId = getDpnForInterface(port.getUuid().getValue());
if (dpId.equals(Uint64.ZERO)) {
LOG.info("DPN ID for interface {} not found", port.getUuid().getValue());
return;
}
LOG.trace("Setting bandwidth limits {} on Port {}", port.getUuid().getValue(), bwLimit);
OvsdbBridgeRef bridgeRefEntry = getBridgeRefEntryFromOperDS(dpId);
Optional<Node> bridgeNode = MDSALUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntry.getValue().firstIdentifierOf(Node.class), dataBroker);
if (!bridgeNode.isPresent()) {
LOG.error("bridge not found for dpn {} port {} in operational datastore", dpId, port.getUuid().getValue());
return;
}
LOG.debug("bridgeNode {}", bridgeNode.get().getNodeId().getValue());
TerminationPoint tp = SouthboundUtils.getTerminationPointByExternalId(bridgeNode.get(), port.getUuid().getValue());
if (tp == null) {
LOG.debug("Skipping setting of bandwidth limit rules for subport {}", port.getUuid().getValue());
return;
}
LOG.debug("tp: {}", tp.getTpId().getValue());
OvsdbTerminationPointAugmentation ovsdbTp = tp.augmentation(OvsdbTerminationPointAugmentation.class);
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder();
tpAugmentationBuilder.setName(ovsdbTp.getName());
tpAugmentationBuilder.setIngressPolicingRate(bwLimit.getMaxKbps().longValue());
tpAugmentationBuilder.setIngressPolicingBurst(bwLimit.getMaxBurstKbps().longValue());
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.withKey(tp.key());
tpBuilder.addAugmentation(tpAugmentationBuilder.build());
try {
if (writeConfigTxn != null) {
writeConfigTxn.mergeParentStructureMerge(InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, bridgeNode.get().key()).child(TerminationPoint.class, new TerminationPointKey(tp.key())), tpBuilder.build());
} else {
MDSALUtil.syncUpdate(dataBroker, LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, bridgeNode.get().key()).child(TerminationPoint.class, new TerminationPointKey(tp.key())), tpBuilder.build());
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Failure while setting BwLimitRule {} to port {} exception ", bwLimit, port.getUuid().getValue(), e);
} else {
LOG.error("Failure while setting BwLimitRule {} to port {}", bwLimit, port.getUuid().getValue());
}
}
}
use of org.opendaylight.yang.gen.v1.urn.tech.pantheon.netconfdevice.network.topology.rpcs.rev180320.topology.data.TopologyKey in project netvirt by opendaylight.
the class ElanServiceTestBase method createInstanceIdentifier.
protected static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node> createInstanceIdentifier(String nodeIdString) {
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId nodeId = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId(new Uri(nodeIdString));
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey nodeKey = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey(nodeId);
TopologyKey topoKey = new TopologyKey(new TopologyId(new Uri("hwvtep:1")));
return InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, topoKey).child(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node.class, nodeKey).build();
}
Aggregations