use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.
the class VtepSchemaAdd method doExecute.
/*
* (non-Javadoc)
*
* @see org.apache.karaf.shell.console.AbstractAction#doExecute()
*/
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
protected Object doExecute() {
try {
if (this.schemaName == null || this.portName == null || this.vlanId == null || this.subnetCIDR == null || this.transportZone == null) {
usage();
return null;
}
LOG.debug("Executing vtep:schema-add command\t {} \t {} \t {} \t {} \t {} \t {} \t {} \t {} \t {}", schemaName, portName, vlanId, subnetCIDR, gatewayIp, transportZone, tunnelType, dpnIds, excludeIpFilter);
if (null == tunnelType) {
tunnelType = ITMConstants.TUNNEL_TYPE_VXLAN;
}
VtepConfigSchema schema = ItmUtils.constructVtepConfigSchema(schemaName, portName, vlanId, subnetCIDR, gatewayIp, transportZone, tunnelType, ItmCliUtils.constructDpnIdList(dpnIds), excludeIpFilter);
this.itmProvider.addVtepConfigSchema(schema);
} catch (Exception e) {
LOG.error("Exception occurred during execution of command \"vtep:schema-add\": ", e);
throw e;
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project netvirt by opendaylight.
the class NeutronvpnUtils method updateVpnInstanceWithFallback.
public void updateVpnInstanceWithFallback(String vpnName, boolean add) {
VpnInstanceOpDataEntry vpnInstanceOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(vpnName);
if (vpnInstanceOpDataEntry == null) {
// BGPVPN context not found
return;
}
String routerIdUuid = getRouterIdfromVpnInstance(vpnInstanceOpDataEntry.getVrfId());
if (routerIdUuid != null) {
List<BigInteger> dpnIds = getDpnsForRouter(routerIdUuid);
if (!dpnIds.isEmpty()) {
Long vpnId = vpnInstanceOpDataEntry.getVpnId();
VpnInstanceOpDataEntry vpnOpDataEntry = getVpnInstanceOpDataEntryFromVpnId(routerIdUuid);
Long routerIdAsLong = vpnOpDataEntry.getVpnId();
if (routerIdAsLong == null) {
return;
}
for (BigInteger dpnId : dpnIds) {
if (add) {
ipV6InternetDefRt.installDefaultRoute(dpnId, vpnId, routerIdAsLong);
} else {
ipV6InternetDefRt.removeDefaultRoute(dpnId, vpnId, routerIdAsLong);
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.
the class ItmManagerRpcService method getTunnelEndPointByDpnIdFromTranPortZone.
private Map<BigInteger, ComputesBuilder> getTunnelEndPointByDpnIdFromTranPortZone(Collection<BigInteger> dpnIds) throws ReadFailedException {
TransportZones transportZones = singleTransactionDataBroker.syncRead(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.builder(TransportZones.class).build());
if (transportZones.getTransportZone() == null || transportZones.getTransportZone().isEmpty()) {
throw new IllegalStateException("Failed to find transport zones in config datastore");
}
Map<BigInteger, ComputesBuilder> result = new HashMap<>();
for (TransportZone transportZone : transportZones.getTransportZone()) {
if (transportZone.getSubnets() == null || transportZone.getSubnets().isEmpty()) {
LOG.debug("Transport Zone {} has no subnets", transportZone.getZoneName());
continue;
}
for (Subnets sub : transportZone.getSubnets()) {
if (sub.getVteps() == null || sub.getVteps().isEmpty()) {
LOG.debug("Transport Zone {} subnet {} has no vteps configured", transportZone.getZoneName(), sub.getPrefix());
continue;
}
for (Vteps vtep : sub.getVteps()) {
if (dpnIds.contains(vtep.getDpnId())) {
result.putIfAbsent(vtep.getDpnId(), new ComputesBuilder().setZoneName(transportZone.getZoneName()).setPrefix(sub.getPrefix()).setDpnId(vtep.getDpnId()).setPortName(vtep.getPortname()).setNodeId(getNodeId(vtep.getDpnId())).setTepIp(Collections.singletonList(vtep.getIpAddress())));
}
}
}
}
for (BigInteger dpnId : dpnIds) {
if (!result.containsKey(dpnId)) {
throw new IllegalStateException("Failed to find dpn id " + dpnId + " in transport zone");
}
}
return result;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.itm.config.rev160406.vtep.config.schemas.vtep.config.schema.DpnIds in project genius by opendaylight.
the class DPNTEPsInfoCache method getDPNTepListFromDPNId.
public List<DPNTEPsInfo> getDPNTepListFromDPNId(List<BigInteger> dpnIds) {
Collection<DPNTEPsInfo> meshedDpnList = this.getAllPresent();
List<DPNTEPsInfo> cfgDpnList = new ArrayList<>();
for (BigInteger dpnId : dpnIds) {
for (DPNTEPsInfo teps : meshedDpnList) {
if (dpnId.equals(teps.getDPNID())) {
cfgDpnList.add(teps);
}
}
}
return cfgDpnList;
}
Aggregations