use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class EvpnTestHelper method updateRdtoNetworks.
public void updateRdtoNetworks(ElanInstance actualElanInstances) throws TransactionCommitFailedException {
EvpnRdToNetworkBuilder evpnRdToNetworkBuilder = new EvpnRdToNetworkBuilder().setKey(new EvpnRdToNetworkKey(RD));
evpnRdToNetworkBuilder.setRd(RD);
evpnRdToNetworkBuilder.setNetworkId(ELAN1);
LOG.info("updating Evpn {} with elaninstance {} and rd {}", "evpn1", actualElanInstances, RD);
singleTxdataBroker.syncWrite(LogicalDatastoreType.CONFIGURATION, getRdToNetworkIdentifier(RD), evpnRdToNetworkBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class IfMgr method updateNetworkElanTag.
public Long updateNetworkElanTag(Uuid networkId) {
Long elanTag = null;
if (null != this.elanProvider) {
ElanInstance elanInstance = this.elanProvider.getElanInstance(networkId.getValue());
if (null != elanInstance) {
elanTag = elanInstance.getElanTag();
VirtualNetwork net = getNetwork(networkId);
if (null != net) {
net.setElanTag(elanTag);
}
}
}
return elanTag;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class VpnUtil method isVlan.
public static boolean isVlan(DataBroker databroker, String interfaceName) {
ElanInterface elanInterface = getElanInterfaceByElanInterfaceName(databroker, interfaceName);
if (elanInterface == null) {
return false;
}
ElanInstance elanInstance = getElanInstanceByName(databroker, elanInterface.getElanInstanceName());
return isVlan(elanInstance);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class VpnServiceElanDpnInterfacesListener method add.
@Override
protected void add(InstanceIdentifier<DpnInterfaces> identifier, DpnInterfaces dpnInterfaces) {
BigInteger dpnId = dpnInterfaces.getDpId();
String elanInstanceName = identifier.firstKeyOf(ElanDpnInterfacesList.class).getElanInstanceName();
ElanInstance elanInstance = VpnUtil.getElanInstanceByName(dataBroker, elanInstanceName);
if (!VpnUtil.isVlan(elanInstance)) {
return;
}
String vpnName = VpnUtil.getVpnNameFromElanIntanceName(dataBroker, elanInstanceName);
if (vpnName == null) {
return;
}
VpnUtil.addRouterPortToElanForVlanInDpn(vpnName, dpnId, dataBroker);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance in project netvirt by opendaylight.
the class ElanServiceChainHandler method programElanScfPipeline.
/**
* Programs the needed flows for sending traffic to the SCF pipeline when
* it is comming from an L2-GW (ELAN) and also for handing over that
* traffic from SCF to ELAN when the packets does not match any Service
* Chain.
*
* @param elanName Name of the ELAN to be considered
* @param tableId Table id, in the SCF Pipeline, to which the traffic must
* go to.
* @param scfTag Tag of the ServiceChain
* @param elanLportTag LPortTag of the ElanPseudoPort that participates in
* the ServiceChain
* @param addOrRemove States if the flows must be created or removed
*/
public void programElanScfPipeline(String elanName, short tableId, long scfTag, int elanLportTag, int addOrRemove) {
LOG.info("programElanScfPipeline: elanName={} scfTag={} elanLportTag={} addOrRemove={}", elanName, scfTag, elanLportTag, addOrRemove);
// There are 3 rules to be considered:
// 1. LportDispatcher To Scf. Matches on elanPseudoPort + SI=1. Goes to DL Subscriber table
// 2. LportDispatcher From Scf. Matches on elanPseudoPort + SI=3. Goes to ELAN DMAC
// 3. ExtTunnelTable From L2GwDevice. Matches on VNI + SI=1. Sets ElanPseudoPort tag and goes
// to LportDispatcher table.
// And these rules must be programmed in all the Elan footprint
// Find the ElanInstance
Optional<ElanInstance> elanInstance = ElanServiceChainUtils.getElanInstanceByName(broker, elanName);
if (!elanInstance.isPresent()) {
LOG.debug("Could not find an Elan Instance with name={}", elanName);
return;
}
Collection<BigInteger> elanDpnsOpc = ElanServiceChainUtils.getElanDpnsByName(broker, elanName);
if (elanDpnsOpc.isEmpty()) {
LOG.debug("Could not find any DPN related to Elan {}", elanName);
return;
}
// updates map which stores relationship between elan and elanLPortTag and scfTag
ElanServiceChainUtils.updateElanToLportTagMap(broker, elanName, elanLportTag, scfTag, addOrRemove);
Long vni = elanInstance.get().getSegmentationId();
if (vni == null) {
LOG.warn("There is no VNI for elan {}. VNI is mandatory. Returning", elanName);
return;
}
int elanTag = elanInstance.get().getElanTag().intValue();
LOG.debug("elanName={} -> vni={} elanTag={}", elanName, vni, elanTag);
// Program ExtTunnelTable.
for (BigInteger dpnId : elanDpnsOpc) {
ElanServiceChainUtils.programLPortDispatcherToScf(mdsalManager, dpnId, elanTag, elanLportTag, tableId, scfTag, addOrRemove);
ElanServiceChainUtils.programLPortDispatcherFromScf(mdsalManager, dpnId, elanLportTag, elanTag, addOrRemove);
ElanServiceChainUtils.programExternalTunnelTable(mdsalManager, dpnId, elanLportTag, vni, elanTag, addOrRemove);
}
}
Aggregations