use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project netvirt by opendaylight.
the class TransportZoneNotificationUtil method addVtep.
/**
* Tries to add a vtep for a transport zone.
*
* @return Whether a vtep was added or not.
*/
private boolean addVtep(TransportZone zone, String subnetIp, BigInteger dpnId, @Nullable String localIp) {
List<Subnets> zoneSubnets = zone.getSubnets();
if (zoneSubnets == null) {
return false;
}
Subnets subnets = getOrAddSubnet(zoneSubnets, subnetIp);
for (Vteps existingVtep : subnets.getVteps()) {
if (existingVtep.getDpnId().equals(dpnId)) {
return false;
}
}
if (localIp != null) {
IpAddress nodeIp = new IpAddress(localIp.toCharArray());
VtepsBuilder vtepsBuilder = new VtepsBuilder().setDpnId(dpnId).setIpAddress(nodeIp).setPortname(TUNNEL_PORT).setOptionOfTunnel(elanConfig.isUseOfTunnels());
subnets.getVteps().add(vtepsBuilder.build());
return true;
}
return false;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project netvirt by opendaylight.
the class OpenFlow13Provider method createEgressClassifierNextHopNoC1C2Flow.
/*
* Egress Classifier NextHop No C1/C2 flow:
* Set C1/C2 accordingly
* Match [C1, C2] == [0, 0], Move [TunIpv4Dst, TunVnid] to [C1, C2],
* Move Reg0 (SFF IP) to TunIpv4Dst, and goto Egress Classifier
* Transport Egress table on match
*/
public Flow createEgressClassifierNextHopNoC1C2Flow(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
OpenFlow13Utils.addMatchNshNsc1(match, DEFAULT_NSH_CONTEXT_VALUE);
OpenFlow13Utils.addMatchNshNsc2(match, DEFAULT_NSH_CONTEXT_VALUE);
List<Action> actionList = new ArrayList<>();
actionList.add(OpenFlow13Utils.createActionNxMoveReg0ToNsc1Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxMoveTunIdToNsc2Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxMoveReg6ToNsc4Register(actionList.size()));
actionList.add(OpenFlow13Utils.createActionNxLoadTunId(SFC_TUNNEL_ID, actionList.size()));
InstructionsBuilder isb = OpenFlow13Utils.wrapActionsIntoApplyActionsInstruction(actionList);
OpenFlow13Utils.appendGotoTableInstruction(isb, NwConstants.EGRESS_SFC_CLASSIFIER_EGRESS_TABLE);
String flowIdStr = EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_FLOW_NAME + nodeId.getValue();
return OpenFlow13Utils.createFlowBuilder(NwConstants.EGRESS_SFC_CLASSIFIER_NEXTHOP_TABLE, EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_PRIORITY, EGRESS_CLASSIFIER_NEXTHOP_COOKIE, EGRESS_CLASSIFIER_NEXTHOP_NOC1C2_FLOW_NAME, flowIdStr, match, isb).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project netvirt by opendaylight.
the class OpenFlow13Provider method createEgressClassifierNextHopC1C2Flow.
/*
* Egress Classifier NextHop with C1/C2 flow:
* Set C1/C2 accordingly
* MatchAny (C1, C2 already set) goto Egress Classifier
* Transport Egress table
*/
public Flow createEgressClassifierNextHopC1C2Flow(NodeId nodeId) {
MatchBuilder match = new MatchBuilder();
InstructionsBuilder isb = OpenFlow13Utils.appendGotoTableInstruction(new InstructionsBuilder(), NwConstants.EGRESS_SFC_CLASSIFIER_EGRESS_TABLE);
String flowIdStr = EGRESS_CLASSIFIER_NEXTHOP_C1C2_FLOW_NAME + nodeId.getValue();
return OpenFlow13Utils.createFlowBuilder(NwConstants.EGRESS_SFC_CLASSIFIER_NEXTHOP_TABLE, EGRESS_CLASSIFIER_NEXTHOP_C1C2_PRIORITY, EGRESS_CLASSIFIER_NEXTHOP_COOKIE, EGRESS_CLASSIFIER_NEXTHOP_C1C2_FLOW_NAME, flowIdStr, match, isb).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class TransportZoneListener method remove.
@Override
public void remove(@Nonnull TransportZone transportZone) {
LOG.debug("Received Transport Zone Remove Event: {}", transportZone);
boolean allowTunnelDeletion;
// due to change in def-tz-tunnel-type, then allow def-tz tunnels deletion
if (transportZone.getZoneName().equalsIgnoreCase(ITMConstants.DEFAULT_TRANSPORT_ZONE)) {
// Get TunnelTypeBase object for tunnel-type configured in config file
Class<? extends TunnelTypeBase> tunType = ItmUtils.getTunnelType(itmConfig.getDefTzTunnelType());
if (!itmConfig.isDefTzEnabled() || !transportZone.getTunnelType().equals(tunType)) {
allowTunnelDeletion = true;
} else {
// this is case when def-tz removal request is from Northbound.
allowTunnelDeletion = false;
LOG.error("Deletion of {} is an incorrect usage", ITMConstants.DEFAULT_TRANSPORT_ZONE);
}
} else {
allowTunnelDeletion = true;
}
if (allowTunnelDeletion) {
// TODO : DPList code can be refactor with new specific class
// which implement TransportZoneValidator
List<DPNTEPsInfo> opDpnList = createDPNTepInfo(transportZone);
List<HwVtep> hwVtepList = createhWVteps(transportZone);
LOG.trace("Delete: Invoking deleteTunnels in ItmManager with DpnList {}", opDpnList);
if (!opDpnList.isEmpty() || !hwVtepList.isEmpty()) {
LOG.trace("Delete: Invoking ItmManager with hwVtep List {} ", hwVtepList);
jobCoordinator.enqueueJob(transportZone.getZoneName(), new ItmTepRemoveWorker(opDpnList, hwVtepList, transportZone, dataBroker, mdsalManager, itmInternalTunnelDeleteWorker, dpnTEPsInfoCache));
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netconf.callhome.server.rev201015.netconf.callhome.server.allowed.devices.device.Transport in project genius by opendaylight.
the class OvsdbTepRemoveConfigHelper method removeUnknownTzTepFromTepsNotHosted.
/**
* Removes the TEP from the not-hosted transport zone in the TepsNotHosted list
* from ITM Operational Datastore.
*
* @param tzName transport zone name in string
* @param tepIpAddress TEP IP address in IpAddress object
* @param dpnId bridge datapath ID in BigInteger
* @param dataBroker data broker handle to perform operations on operational datastore
* @param wrTx WriteTransaction object
*/
public static void removeUnknownTzTepFromTepsNotHosted(String tzName, IpAddress tepIpAddress, BigInteger dpnId, DataBroker dataBroker, WriteTransaction wrTx) {
List<UnknownVteps> vtepList = null;
TepsInNotHostedTransportZone tepsInNotHostedTransportZone = ItmUtils.getUnknownTransportZoneFromITMOperDS(tzName, dataBroker);
if (tepsInNotHostedTransportZone == null) {
LOG.trace("Unhosted TransportZone ({}) does not exist in OperDS. Nothing to do for TEP removal.", tzName);
return;
} else {
vtepList = tepsInNotHostedTransportZone.getUnknownVteps();
if (vtepList == null || vtepList.isEmpty()) {
// case: vtep list does not exist or it has no elements
LOG.trace("Remove TEP from unhosted TZ ({}) when no vtep-list in the TZ. Nothing to do.", tzName);
} else {
// case: vtep list has elements
boolean vtepFound = false;
UnknownVteps foundVtep = null;
for (UnknownVteps vtep : vtepList) {
if (vtep.getDpnId().equals(dpnId)) {
vtepFound = true;
foundVtep = vtep;
break;
}
}
if (vtepFound) {
// vtep is found, update it with tep-ip
LOG.trace("Remove TEP with IP ({}) from unhosted TZ ({}) inside not-hosted-transport-zones list.", tepIpAddress, tzName);
if (vtepList.size() == 1) {
removeTzFromTepsNotHosted(tzName, wrTx);
} else {
removeVtepFromTepsNotHosted(tzName, dpnId, wrTx);
}
vtepList.remove(foundVtep);
}
}
}
}
Aggregations