use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project lispflowmapping by opendaylight.
the class SubnetDataProcessor method create.
/**
* Method adds the newly created subnet as an EID prefix to the
* MappingService. The subnet's network UUID is used as the key for this EID
* prefix.
*/
@Override
public void create(Subnet subnet) {
// TODO update for multi-tenancy
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
LOG.debug("Lisp Neutron Subnet: " + subnet.toString());
// Determine the IANA code for the subnet IP version
// Default is set to IPv4 for neutron subnets
final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
try {
final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();
if (lfmdb == null) {
LOG.debug("lfmdb is null!!!");
return;
}
final AddKeyInput addKeyInput = LispUtil.buildAddKeyInput(eid, subnet.getUuid().getValue());
final Future<RpcResult<Void>> result = lfmdb.addKey(addKeyInput);
final Boolean isSuccessful = result.get().isSuccessful();
if (isSuccessful) {
LOG.debug("Neutron Subnet Added to MapServer : Subnet name: " + subnet.getName() + " EID Prefix: " + subnet.getCidr() + " Key: " + subnet.getUuid());
}
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
} catch (InterruptedException | ExecutionException e) {
LOG.error("Adding new subnet to lisp service mapping service failed. Subnet : " + subnet.toString() + "Error: " + ExceptionUtils.getStackTrace(e));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project genius by opendaylight.
the class ItmTepAutoConfigTest method tepAddDeleteFromNbTzViaSouthboundTest.
@Test
public void tepAddDeleteFromNbTzViaSouthboundTest() throws Exception {
// create Transport-zone in advance
ItmUtils.syncWrite(LogicalDatastoreType.CONFIGURATION, tzonesPath, transportZones, dataBroker);
String tepIp = ItmTestConstants.NB_TZ_TEP_IP;
// create Network topology node with tep-ip set into ExternalIds list
// OvsdbNodeListener would be automatically listen on Node to add TEP
ConnectionInfo connInfo = OvsdbTestUtil.getConnectionInfo(ItmTestConstants.OVSDB_CONN_PORT, ItmTestConstants.LOCALHOST_IP);
CheckedFuture<Void, TransactionCommitFailedException> future = OvsdbTestUtil.createNode(connInfo, tepIp, ItmTestConstants.TZ_NAME, dataBroker);
future.get();
// add bridge into node
future = OvsdbTestUtil.addBridgeIntoNode(connInfo, ItmTestConstants.DEF_BR_NAME, ItmTestConstants.DEF_BR_DPID, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
Thread.sleep(1000);
InstanceIdentifier<TransportZone> tzonePath = ItmTepAutoConfigTestUtil.getTzIid(ItmTestConstants.TZ_NAME);
Assert.assertNotNull(tzonePath);
// check TEP is added into NB configured TZ
assertEqualBeans(ExpectedTransportZoneObjects.newTransportZone(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, tzonePath).checkedGet().get());
IpPrefix subnetMaskObj = ItmUtils.getDummySubnet();
InstanceIdentifier<Vteps> vtepPath = ItmTepAutoConfigTestUtil.getTepIid(subnetMaskObj, ItmTestConstants.TZ_NAME, ItmTestConstants.INT_DEF_BR_DPID, ITMConstants.DUMMY_PORT);
Assert.assertNotNull(vtepPath);
// test TEP delete now,
// pass tep-ip with NULL value, tep-ip paramtere in external_ids will not be set.
tepIp = null;
future = OvsdbTestUtil.updateNode(connInfo, tepIp, ItmTestConstants.TZ_NAME, null, dataBroker);
future.get();
// wait for OvsdbNodeListener to perform config DS update through transaction
Thread.sleep(1000);
// check TEP is deleted from default-TZ when TEP-Ip is removed from southbound
Assert.assertEquals(Optional.absent(), dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, vtepPath).get());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project genius by opendaylight.
the class ItmUtils method getBridgeDpid.
/**
* Gets the bridge datapath ID from Network topology Node's OvsdbBridgeAugmentation, in the Operational DS.
*
* @param node Network Topology Node
*
* @param bridge bridge name
*
* @param dataBroker data broker handle to perform operations on datastore
*
* @return the datapath ID of bridge in string form
*/
public static String getBridgeDpid(Node node, String bridge, DataBroker dataBroker) {
OvsdbBridgeAugmentation ovsdbBridgeAugmentation = null;
Node bridgeNode = null;
String datapathId = null;
NodeId ovsdbNodeId = node.getKey().getNodeId();
NodeId brNodeId = new NodeId(ovsdbNodeId.getValue() + "/" + ITMConstants.BRIDGE_URI_PREFIX + "/" + bridge);
InstanceIdentifier<Node> bridgeIid = InstanceIdentifier.create(NetworkTopology.class).child(Topology.class, new TopologyKey(IfmConstants.OVSDB_TOPOLOGY_ID)).child(Node.class, new NodeKey(brNodeId));
Optional<Node> opBridgeNode = ItmUtils.read(LogicalDatastoreType.OPERATIONAL, bridgeIid, dataBroker);
if (opBridgeNode.isPresent()) {
bridgeNode = opBridgeNode.get();
}
if (bridgeNode != null) {
ovsdbBridgeAugmentation = bridgeNode.getAugmentation(OvsdbBridgeAugmentation.class);
}
if (ovsdbBridgeAugmentation != null && ovsdbBridgeAugmentation.getDatapathId() != null) {
datapathId = ovsdbBridgeAugmentation.getDatapathId().getValue();
}
return datapathId;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.
the class L2GatewayConnectionUtils method addL2GatewayConnection.
public void addL2GatewayConnection(final L2gatewayConnection input, final String l2GwDeviceName, L2gateway l2Gateway) {
LOG.info("Adding L2gateway Connection with ID: {}", input.getKey().getUuid());
Uuid networkUuid = input.getNetworkId();
// Taking cluster reboot scenario , if Elan instance is not available when l2GatewayConnection add events
// comes we need to wait for elaninstance to resolve. Hence updating the map with the runnable .
// When elanInstance add comes , it look in to the map and run the associated runnable associated with it.
ElanInstance elanInstance = elanInstanceCache.get(networkUuid.getValue(), () -> addL2GatewayConnection(input, l2GwDeviceName)).orNull();
if (elanInstance == null) {
return;
}
if (!isVxlanNetworkOrVxlanSegment(elanInstance)) {
LOG.error("Neutron network with id {} is not VxlanNetwork", networkUuid.getValue());
} else {
Uuid l2GatewayId = input.getL2gatewayId();
if (l2Gateway == null) {
l2Gateway = getNeutronL2gateway(broker, l2GatewayId);
}
if (l2Gateway == null) {
LOG.error("L2Gateway with id {} is not present", l2GatewayId.getValue());
} else {
associateHwvtepsToElan(elanInstance, l2Gateway, input, l2GwDeviceName);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.dhcp_allocation_pool.rev161214.dhcp_allocation_pool.Network in project netvirt by opendaylight.
the class ElanUtils method setupRemoteDmacFlow.
public void setupRemoteDmacFlow(BigInteger srcDpId, BigInteger destDpId, int lportTag, long elanTag, String macAddress, String displayName, WriteTransaction writeFlowGroupTx, String interfaceName, ElanInstance elanInstance) throws ElanException {
if (interfaceManager.isExternalInterface(interfaceName)) {
LOG.debug("Ignoring install remote DMAC {} flow on provider interface {} elan {}", macAddress, interfaceName, elanInstance.getElanInstanceName());
return;
}
Flow flowEntity;
// if openstack-vni-semantics are enforced, segmentation ID is passed as network VNI for VxLAN based provider
// networks, 0 otherwise
long lportTagOrVni = !isOpenstackVniSemanticsEnforced() ? lportTag : isVxlanNetworkOrVxlanSegment(elanInstance) ? getVxlanSegmentationId(elanInstance) : 0;
flowEntity = buildRemoteDmacFlowEntry(srcDpId, destDpId, lportTagOrVni, elanTag, macAddress, displayName, elanInstance);
mdsalManager.addFlowToTx(srcDpId, flowEntity, writeFlowGroupTx);
setupEtreeRemoteDmacFlow(srcDpId, destDpId, lportTagOrVni, elanTag, macAddress, displayName, interfaceName, writeFlowGroupTx, elanInstance);
}
Aggregations