use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project netvirt by opendaylight.
the class ElanBridgeManager method copyBridgeToConfig.
private void copyBridgeToConfig(Node brIntNode) {
NodeBuilder bridgeNodeBuilder = new NodeBuilder(brIntNode);
// termination points need to be masssaged to remove the ifindex field
// which are not allowed in the config data store
List<TerminationPoint> terminationPoints = brIntNode.getTerminationPoint();
if (terminationPoints != null) {
List<TerminationPoint> newTerminationPoints = new ArrayList<>();
for (TerminationPoint tp : terminationPoints) {
OvsdbTerminationPointAugmentation ovsdbTerminationPointAugmentation = tp.getAugmentation(OvsdbTerminationPointAugmentation.class);
TerminationPointBuilder tpBuilder = new TerminationPointBuilder(tp);
if (ovsdbTerminationPointAugmentation != null) {
OvsdbTerminationPointAugmentationBuilder tpAugmentationBuilder = new OvsdbTerminationPointAugmentationBuilder(ovsdbTerminationPointAugmentation);
tpAugmentationBuilder.setIfindex(null);
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
}
newTerminationPoints.add(tpBuilder.build());
}
bridgeNodeBuilder.setTerminationPoint(newTerminationPoints);
}
InstanceIdentifier<Node> brNodeIid = SouthboundUtils.createInstanceIdentifier(brIntNode.getNodeId());
this.mdsalUtils.put(LogicalDatastoreType.CONFIGURATION, brNodeIid, bridgeNodeBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project netvirt by opendaylight.
the class TestInterfaceManager method getTunnelPortsOnBridge.
@Override
public List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(BigInteger dpnId) {
if (dpnId == GeniusProviderTestParams.DPN_ID_NO_EXIST) {
// Unfortunately, the getTunnelPortsOnBridge() method may return null
return null;
}
if (dpnId == GeniusProviderTestParams.DPN_ID_NO_PORTS) {
return Collections.emptyList();
}
OvsdbTerminationPointAugmentationBuilder tpAug = new OvsdbTerminationPointAugmentationBuilder();
tpAug.setOfport(GeniusProviderTestParams.OF_PORT);
if (dpnId == GeniusProviderTestParams.DPN_ID_NO_VXGPE_PORTS) {
// Tunnel Termination Point that is NOT of type VXGPE
tpAug.setInterfaceType(InterfaceTypeGre.class);
} else {
// Tunnel Termination Point that IS of type VXGPE
tpAug.setInterfaceType(InterfaceTypeVxlan.class);
}
List<Options> opsList = new ArrayList<>();
if (dpnId != GeniusProviderTestParams.DPN_ID_NO_OPTIONS) {
OptionsBuilder opsBuilder = new OptionsBuilder();
opsBuilder.setKey(new OptionsKey(GeniusProvider.OPTION_KEY_EXTS));
opsBuilder.setValue(GeniusProvider.OPTION_VALUE_EXTS_GPE);
opsList.add(opsBuilder.build());
}
tpAug.setOptions(opsList);
List<OvsdbTerminationPointAugmentation> tpAugList = new ArrayList<>();
tpAugList.add(tpAug.build());
return tpAugList;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation 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, WriteTransaction writeConfigTxn) {
if (!qosEosHandler.isQosClusterOwner()) {
LOG.trace("Not Qos Cluster Owner. Ignoring setting bandwidth limits");
return;
}
LOG.trace("Setting bandwidth limits {} on Port {}", port, bwLimit);
BigInteger dpId = getDpnForInterface(port.getUuid().getValue());
if (dpId.equals(BigInteger.ZERO)) {
LOG.info("DPN ID for interface {} not found", port.getUuid().getValue());
return;
}
OvsdbBridgeRef bridgeRefEntry = getBridgeRefEntryFromOperDS(dpId);
Optional<Node> bridgeNode = MDSALUtil.read(LogicalDatastoreType.OPERATIONAL, bridgeRefEntry.getValue().firstIdentifierOf(Node.class), dataBroker);
TerminationPoint tp = SouthboundUtils.getTerminationPointByExternalId(bridgeNode.get(), port.getUuid().getValue());
OvsdbTerminationPointAugmentation ovsdbTp = tp.getAugmentation(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.setKey(tp.getKey());
tpBuilder.addAugmentation(OvsdbTerminationPointAugmentation.class, tpAugmentationBuilder.build());
try {
if (writeConfigTxn != null) {
writeConfigTxn.put(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(SouthboundUtils.OVSDB_TOPOLOGY_ID)).child(Node.class, bridgeNode.get().getKey()).child(TerminationPoint.class, new TerminationPointKey(tp.getKey())), 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().getKey()).child(TerminationPoint.class, new TerminationPointKey(tp.getKey())), tpBuilder.build());
}
} catch (Exception e) {
LOG.error("Failure while setting BwLimitRule {} to port {}", bwLimit, port, e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project netvirt by opendaylight.
the class GeniusProvider method getEgressVxlanPortForNode.
public Optional<Long> getEgressVxlanPortForNode(BigInteger dpnId) {
List<OvsdbTerminationPointAugmentation> tpList = interfaceMgr.getTunnelPortsOnBridge(dpnId);
if (tpList == null) {
// Most likely the bridge doesnt exist for this dpnId
LOG.warn("getEgressVxlanPortForNode Tunnel Port TerminationPoint list not available for dpnId [{}]", dpnId);
return Optional.empty();
}
for (OvsdbTerminationPointAugmentation tp : tpList) {
if (tp == null) {
// Technically we should never have a list with NULL entries, but
// in a preliminary version of interfaceMgr.getTunnelPortsOnBridge()
// we were getting a list where all termination point entries were
// null. Leaving this check for now for protection.
LOG.error("getEgressVxlanPortForNode received a NULL termination point from tpList on dpnId [{}]", dpnId);
continue;
}
Class<? extends InterfaceTypeBase> ifType = tp.getInterfaceType();
if (ifType.equals(InterfaceTypeVxlan.class)) {
List<Options> tpOptions = tp.getOptions();
for (Options tpOption : tpOptions) {
// From the VXLAN Tunnels, we want the one with the GPE option set
if (tpOption.getKey().getOption().equals(OPTION_KEY_EXTS)) {
if (tpOption.getValue().equals(OPTION_VALUE_EXTS_GPE)) {
return Optional.ofNullable(tp.getOfport());
}
}
}
}
}
LOG.warn("getEgressVxlanPortForNode no Vxgpe tunnel ports available for dpnId [{}]", dpnId);
return Optional.empty();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation in project genius by opendaylight.
the class InterfacemgrProvider method getTunnelPortsOnBridge.
/**
* Get all termination points of type tunnel on a given DPN.
*
* @param dpnId
* Datapath Node Identifier
*
* @return If the data at the supplied path exists, returns a list of all termination point
* Augmentations of type tunnel
*/
@Override
public List<OvsdbTerminationPointAugmentation> getTunnelPortsOnBridge(BigInteger dpnId) {
List<OvsdbTerminationPointAugmentation> tunnelPorts = new ArrayList<>();
List<TerminationPoint> portList = interfaceMetaUtils.getTerminationPointsOnBridge(dpnId);
for (TerminationPoint ovsPort : portList) {
OvsdbTerminationPointAugmentation portAug = ovsPort.getAugmentation(OvsdbTerminationPointAugmentation.class);
if (portAug != null && SouthboundUtils.isInterfaceTypeTunnel(portAug.getInterfaceType())) {
tunnelPorts.add(portAug);
}
}
LOG.debug("Found {} tunnel ports on bridge {}", tunnelPorts.size(), dpnId);
return tunnelPorts;
}
Aggregations