use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project genius by opendaylight.
the class ShowOvsPorts method doExecute.
@Override
protected Object doExecute() {
LOG.debug("Executing show ovs-ports command");
List<OvsdbTerminationPointAugmentation> ports = interfaceManager.getPortsOnBridge(dpnId);
if (!ports.isEmpty()) {
IfmCLIUtil.showBridgePortsHeader(session, dpnId);
}
for (OvsdbTerminationPointAugmentation port : ports) {
IfmCLIUtil.showBridgePortsOutput(session, port);
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project netvirt by opendaylight.
the class QosNeutronUtils method displayQosPortsMap.
private void displayQosPortsMap(CommandSession session, Gson gson) {
session.getConsole().println("\nQOS Ports Map");
String policyId;
String policyName;
String portUuid;
String portName;
String portDetails;
Uuid policyUuid;
Uuid portId;
JsonObject jsonObject;
JsonArray jsonArrayOuter = new JsonArray();
JsonArray jsonArray;
for (ConcurrentMap.Entry<Uuid, ConcurrentMap<Uuid, Port>> policyEntry : qosPortsMap.entrySet()) {
policyUuid = policyEntry.getKey();
policyId = policyUuid.getValue();
policyName = qosPolicyMap.get(policyUuid).getName();
jsonObject = new JsonObject();
jsonArray = new JsonArray();
jsonObject.addProperty("Policy Uuid", policyId);
jsonObject.addProperty("Policy Name", policyName);
ConcurrentMap<Uuid, Port> portInnerMap = qosPortsMap.get(policyUuid);
for (ConcurrentMap.Entry<Uuid, Port> portEntry : portInnerMap.entrySet()) {
portId = portEntry.getKey();
if (portId != null) {
portUuid = portInnerMap.get(portId).getUuid().getValue();
portName = portInnerMap.get(portId).getName();
if (portName == null) {
portName = "null";
}
portDetails = portUuid + " : " + portName;
jsonArray.add(portDetails);
}
}
jsonObject.add("Port Details", jsonArray);
jsonArrayOuter.add(jsonObject);
}
session.getConsole().println(gson.toJson(jsonArrayOuter));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project netvirt by opendaylight.
the class NeutronvpnNatManager method removeAdjacencyAndLearnedEntriesforExternalSubnet.
private void removeAdjacencyAndLearnedEntriesforExternalSubnet(Uuid extNetId, Uuid extSubnetId) {
Collection<String> extElanInterfaces = elanService.getExternalElanInterfaces(extNetId.getValue());
if (extElanInterfaces == null || extElanInterfaces.isEmpty()) {
LOG.error("No external ports attached to external network {}", extNetId.getValue());
return;
}
for (String infName : extElanInterfaces) {
InstanceIdentifier<VpnInterface> vpnIfIdentifier = InstanceIdentifier.builder(VpnInterfaces.class).child(VpnInterface.class, new VpnInterfaceKey(infName)).build();
InstanceIdentifier<Adjacencies> adjacenciesIdentifier = vpnIfIdentifier.augmentation(Adjacencies.class);
try {
// Looking for existing prefix in MDSAL database
Optional<Adjacencies> optionalAdjacencies = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.CONFIGURATION, adjacenciesIdentifier);
if (optionalAdjacencies.isPresent()) {
Map<AdjacencyKey, Adjacency> keyAdjacencyMap = optionalAdjacencies.get().nonnullAdjacency();
Iterator<Adjacency> adjacencyIter = keyAdjacencyMap.values().iterator();
while (adjacencyIter.hasNext()) {
Adjacency adjacency = adjacencyIter.next();
if (!adjacency.getSubnetId().equals(extSubnetId)) {
continue;
}
InstanceIdentifier<Adjacency> adjacencyIdentifier = adjacenciesIdentifier.child(Adjacency.class, new AdjacencyKey(adjacency.getIpAddress()));
SingleTransactionDataBroker.syncDelete(dataBroker, LogicalDatastoreType.CONFIGURATION, adjacencyIdentifier);
LOG.trace("Removed Adjacency for fixedIP {} for port {} on external subnet {} ", adjacency.getIpAddress(), infName, extSubnetId);
String extNetVpnName = extNetId.getValue();
String learnedSrcIp = adjacency.getIpAddress().split("/")[0];
InstanceIdentifier<LearntVpnVipToPort> id = NeutronvpnUtils.buildLearntVpnVipToPortIdentifier(extNetVpnName, learnedSrcIp);
Optional<LearntVpnVipToPort> optionalLearntVpnVipToPort = SingleTransactionDataBroker.syncReadOptional(dataBroker, LogicalDatastoreType.OPERATIONAL, id);
if (optionalLearntVpnVipToPort.isPresent()) {
neutronvpnUtils.removeLearntVpnVipToPort(extNetVpnName, learnedSrcIp);
LOG.trace("Removed Learnt Entry for fixedIP {} for port {}", adjacency.getIpAddress(), infName);
}
}
}
} catch (TransactionCommitFailedException | ExecutionException | InterruptedException e) {
LOG.error("exception in removeAdjacencyAndLearnedEntriesforExternalSubnet for interface {}", infName, e);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project netvirt by opendaylight.
the class VpnManagerImpl method createIdPool.
private void createIdPool() {
CreateIdPoolInput createPool = new CreateIdPoolInputBuilder().setPoolName(VpnConstants.VPN_IDPOOL_NAME).setLow(VpnConstants.VPN_IDPOOL_LOW).setHigh(VpnConstants.VPN_IDPOOL_HIGH).build();
try {
Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPool);
if (result != null && result.get().isSuccessful()) {
LOG.info("Created IdPool for VPN Service");
} else {
LOG.error("createIdPool: Unable to create ID pool for VPNService");
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to create idPool for VPN Service", e);
}
// Now an IdPool for InterVpnLink endpoint's pseudo ports
CreateIdPoolInput createPseudoLporTagPool = new CreateIdPoolInputBuilder().setPoolName(VpnConstants.PSEUDO_LPORT_TAG_ID_POOL_NAME).setLow(VpnConstants.LOWER_PSEUDO_LPORT_TAG).setHigh(VpnConstants.UPPER_PSEUDO_LPORT_TAG).build();
try {
Future<RpcResult<CreateIdPoolOutput>> result = idManager.createIdPool(createPseudoLporTagPool);
if (result != null && result.get().isSuccessful()) {
LOG.debug("Created IdPool for Pseudo Port tags");
} else {
StringBuilder errMsg = new StringBuilder();
if (result != null && result.get() != null) {
Collection<RpcError> errors = result.get().getErrors();
for (RpcError err : errors) {
errMsg.append(err.getMessage()).append("\n");
}
}
LOG.error("IdPool creation for PseudoPort tags failed. Reasons: {}", errMsg);
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Failed to create idPool for Pseudo Port tags", e);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.flowspec.flowspec.type.port._case.Ports in project netvirt by opendaylight.
the class NeutronBgpvpnChangeListener method handleRoutersUpdate.
/**
* Handle routers update.
*
* @deprecated Retaining method for backward compatibility. Below method needs to be removed once
* updated to latest BGPVPN API's.
*
* @param vpnId the vpn id
* @param oldRouters the old routers
* @param newRouters the new routers
*/
@Deprecated
private void handleRoutersUpdate(Uuid vpnId, List<Uuid> oldRouters, List<Uuid> newRouters) {
// TODO: check router ports ethertype to follow this restriction
if (oldRouters != null && !oldRouters.isEmpty()) {
// remove to oldRouters the newRouters if existing
List<Uuid> oldRoutersCopy = new ArrayList<>();
oldRoutersCopy.addAll(oldRouters);
if (newRouters != null) {
newRouters.forEach(r -> oldRoutersCopy.remove(r));
}
/* dissociate old router */
oldRoutersCopy.forEach(r -> {
nvpnManager.dissociateRouterFromVpn(vpnId, r);
});
}
if (newRouters != null && !newRouters.isEmpty()) {
if (newRouters.size() > NeutronConstants.MAX_ROUTERS_PER_BGPVPN) {
LOG.debug("In handleRoutersUpdate: maximum allowed number of associated routers is 2. VPN: {} " + "is already associated with router: {} and with router: {}", vpnId, newRouters.get(0).getValue(), newRouters.get(1).getValue());
return;
} else {
for (Uuid routerId : newRouters) {
if (oldRouters != null && oldRouters.contains(routerId)) {
continue;
}
/* If the first time BGP-VPN is getting associated with router, then no need
to validate if the router is already been associated with any other BGP-VPN.
This will avoid unnecessary MD-SAL data store read operations in VPN-MAPS.
*/
if (oldRouters == null || oldRouters.isEmpty()) {
nvpnManager.associateRouterToVpn(vpnId, routerId);
} else if (validateRouteInfo(routerId)) {
nvpnManager.associateRouterToVpn(vpnId, routerId);
}
}
}
}
}
Aggregations