use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation in project genius by opendaylight.
the class OvsdbSouthboundTestUtil method deleteBridge.
public static void deleteBridge(DataBroker dataBroker) throws TransactionCommitFailedException {
final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid = bridgeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
LOG.debug("Built with the intent to delete bridge data {}", bridgeIid.toString());
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.delete(LogicalDatastoreType.OPERATIONAL, ovsdbBridgeIid);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation in project genius by opendaylight.
the class OvsdbSouthboundTestUtil method createBridge.
public static void createBridge(DataBroker dataBroker) throws TransactionCommitFailedException {
final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid = bridgeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
final NodeId bridgeNodeId = createManagedNodeId(bridgeIid);
final NodeBuilder bridgeCreateNodeBuilder = new NodeBuilder();
bridgeCreateNodeBuilder.setNodeId(bridgeNodeId);
OvsdbBridgeAugmentationBuilder bridgeCreateAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
bridgeCreateAugmentationBuilder.setBridgeName(ovsdbBridgeName).setDatapathId(new DatapathId("00:00:00:00:00:00:00:01"));
bridgeCreateNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, bridgeCreateAugmentationBuilder.build());
LOG.debug("Built with the intent to store bridge data {}", bridgeCreateAugmentationBuilder.toString());
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.put(LogicalDatastoreType.OPERATIONAL, ovsdbBridgeIid, bridgeCreateAugmentationBuilder.build(), true);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation in project genius by opendaylight.
the class OvsdbSouthboundTestUtil method updateBridge.
public static void updateBridge(DataBroker dataBroker, String datapathId) throws TransactionCommitFailedException {
final OvsdbBridgeName ovsdbBridgeName = new OvsdbBridgeName("s2");
final InstanceIdentifier<Node> bridgeIid = createInstanceIdentifier("192.168.56.101", 6640, ovsdbBridgeName);
final InstanceIdentifier<OvsdbBridgeAugmentation> ovsdbBridgeIid = bridgeIid.builder().augmentation(OvsdbBridgeAugmentation.class).build();
final NodeId bridgeNodeId = createManagedNodeId(bridgeIid);
final NodeBuilder bridgeCreateNodeBuilder = new NodeBuilder();
bridgeCreateNodeBuilder.setNodeId(bridgeNodeId);
OvsdbBridgeAugmentationBuilder bridgeCreateAugmentationBuilder = new OvsdbBridgeAugmentationBuilder();
bridgeCreateAugmentationBuilder.setBridgeName(ovsdbBridgeName).setDatapathId(new DatapathId(datapathId));
bridgeCreateNodeBuilder.addAugmentation(OvsdbBridgeAugmentation.class, bridgeCreateAugmentationBuilder.build());
LOG.debug("Built with the intent to store bridge data {}", bridgeCreateAugmentationBuilder.toString());
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.OPERATIONAL, ovsdbBridgeIid, bridgeCreateAugmentationBuilder.build(), true);
tx.submit().checkedGet();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation in project genius by opendaylight.
the class ItmUtils method getOvsdbNode.
/**
* Gets the Network topology Node from Operational Datastore
* based on Bridge Augmentation.
*
* @param bridgeAugmentation bridge augmentation of OVSDB node
*
* @param dataBroker data broker handle to perform operations on datastore
*
* @return the Network Topology Node i.e. OVSDB node which is managing the specified bridge
*/
public static Node getOvsdbNode(OvsdbBridgeAugmentation bridgeAugmentation, DataBroker dataBroker) {
Node ovsdbNode = null;
Optional<Node> opOvsdbNode = Optional.absent();
if (bridgeAugmentation != null) {
InstanceIdentifier<Node> ovsdbNodeIid = (InstanceIdentifier<Node>) bridgeAugmentation.getManagedBy().getValue();
opOvsdbNode = ItmUtils.read(LogicalDatastoreType.OPERATIONAL, ovsdbNodeIid, dataBroker);
}
if (opOvsdbNode.isPresent()) {
ovsdbNode = opOvsdbNode.get();
}
return ovsdbNode;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAugmentation in project genius by opendaylight.
the class OvsdbNodeListener method add.
@Override
public void add(@Nonnull Node ovsdbNodeNew) {
String bridgeName = null;
String strDpnId = "";
OvsdbNodeAugmentation ovsdbNewNodeAugmentation = null;
LOG.trace("OvsdbNodeListener called for Ovsdb Node ({}) Add.", ovsdbNodeNew.getNodeId().getValue());
// check for OVS bridge node
OvsdbBridgeAugmentation ovsdbNewBridgeAugmentation = ovsdbNodeNew.getAugmentation(OvsdbBridgeAugmentation.class);
if (ovsdbNewBridgeAugmentation != null) {
processBridgeUpdate(ovsdbNewBridgeAugmentation);
}
}
Aggregations