use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface in project netvirt by opendaylight.
the class ElanInterfaceStateClusteredListener method handleExternalTunnelUpdate.
private void handleExternalTunnelUpdate(String interfaceName, Interface update) throws ElanException {
ExternalTunnel externalTunnel = elanUtils.getExternalTunnel(interfaceName, LogicalDatastoreType.CONFIGURATION);
if (externalTunnel != null) {
LOG.debug("handling external tunnel update event for ext device dst {} src {} ", externalTunnel.getDestinationDevice(), externalTunnel.getSourceDevice());
elanInterfaceManager.handleExternalTunnelStateEvent(externalTunnel, update);
} else {
LOG.trace("External tunnel not found with interfaceName: {}", interfaceName);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface in project netvirt by opendaylight.
the class ElanPacketInHandler method onPacketReceived.
@Override
public void onPacketReceived(PacketReceived notification) {
Class<? extends PacketInReason> pktInReason = notification.getPacketInReason();
short tableId = notification.getTableId().getValue();
if (pktInReason == NoMatch.class && tableId == NwConstants.ELAN_SMAC_TABLE) {
ElanManagerCounters.unknown_smac_pktin_rcv.inc();
try {
byte[] data = notification.getPayload();
Ethernet res = new Ethernet();
res.deserialize(data, 0, data.length * NetUtils.NUM_BITS_IN_A_BYTE);
byte[] srcMac = res.getSourceMACAddress();
final String macAddress = NWUtil.toStringMacAddress(srcMac);
final BigInteger metadata = notification.getMatch().getMetadata().getMetadata();
final long elanTag = MetaDataUtil.getElanTagFromMetadata(metadata);
long portTag = MetaDataUtil.getLportFromMetadata(metadata).intValue();
Optional<IfIndexInterface> interfaceInfoOp = elanUtils.getInterfaceInfoByInterfaceTag(portTag);
if (!interfaceInfoOp.isPresent()) {
LOG.warn("There is no interface for given portTag {}", portTag);
return;
}
String interfaceName = interfaceInfoOp.get().getInterfaceName();
LOG.debug("Received a packet with srcMac: {} ElanTag: {} PortTag: {} InterfaceName: {}", macAddress, elanTag, portTag, interfaceName);
ElanTagName elanTagName = elanUtils.getElanInfoByElanTag(elanTag);
if (elanTagName == null) {
LOG.warn("not able to find elanTagName in elan-tag-name-map for elan tag {}", elanTag);
return;
}
ElanInterfaceMac elanInterfaceMac = elanUtils.getElanInterfaceMacByInterfaceName(interfaceName);
if (elanInterfaceMac == null) {
LOG.info("There is no ElanInterfaceForwardingEntryDS created for interface :{}", interfaceName);
return;
}
String elanName = elanTagName.getName();
PhysAddress physAddress = new PhysAddress(macAddress);
MacEntry oldMacEntry = elanUtils.getMacEntryForElanInstance(elanName, physAddress).orNull();
boolean isVlanOrFlatProviderIface = interfaceManager.isExternalInterface(interfaceName);
Optional<IpAddress> srcIpAddress = elanUtils.getSourceIpAddress(res);
MacEntry newMacEntry = null;
BigInteger timeStamp = new BigInteger(String.valueOf(System.currentTimeMillis()));
if (!srcIpAddress.isPresent()) {
newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setMacAddress(physAddress).setKey(new MacEntryKey(physAddress)).setControllerLearnedForwardingEntryTimestamp(timeStamp).setIsStaticAddress(false).build();
} else {
newMacEntry = new MacEntryBuilder().setInterface(interfaceName).setMacAddress(physAddress).setIpPrefix(srcIpAddress.get()).setKey(new MacEntryKey(physAddress)).setControllerLearnedForwardingEntryTimestamp(timeStamp).setIsStaticAddress(false).build();
}
if (srcIpAddress.isPresent()) {
String prefix = srcIpAddress.get().getIpv4Address().getValue();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
evpnUtils.advertisePrefix(elanInstance, macAddress, prefix, interfaceName, interfaceInfo.getDpId());
}
enqueueJobForMacSpecificTasks(macAddress, elanTag, interfaceName, elanName, physAddress, oldMacEntry, newMacEntry, isVlanOrFlatProviderIface);
ElanInstance elanInstance = elanInstanceCache.get(elanName).orNull();
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(interfaceName);
if (interfaceInfo == null) {
LOG.trace("Interface:{} is not present under Config DS", interfaceName);
return;
}
enqueueJobForDPNSpecificTasks(macAddress, elanTag, interfaceName, physAddress, elanInstance, interfaceInfo, oldMacEntry, newMacEntry, isVlanOrFlatProviderIface);
} catch (PacketException e) {
LOG.error("Failed to decode packet: {}", notification, e);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface in project netvirt by opendaylight.
the class EvpnUtils method advertiseEvpnRT2Routes.
@SuppressWarnings("checkstyle:IllegalCatch")
public void advertiseEvpnRT2Routes(EvpnAugmentation evpnAugmentation, String elanName) {
if (evpnAugmentation == null || evpnAugmentation.getEvpnName() == null) {
return;
}
String evpnName = evpnAugmentation.getEvpnName();
List<MacEntry> macEntries = elanUtils.getElanMacEntries(elanName);
if (macEntries == null || macEntries.isEmpty()) {
LOG.trace("advertiseEvpnRT2Routes no elan mac entries found for {}", elanName);
return;
}
String rd = vpnManager.getVpnRd(broker, evpnName);
ElanInstance elanInfo = elanInstanceCache.get(elanName).orNull();
macEntries.stream().filter(isIpv4PrefixAvailable).forEach(macEntry -> {
InterfaceInfo interfaceInfo = interfaceManager.getInterfaceInfo(macEntry.getInterface());
if (interfaceInfo == null) {
LOG.debug("advertiseEvpnRT2Routes, interfaceInfo is null for interface {}", macEntry.getInterface());
return;
}
advertisePrefix(elanInfo, rd, macEntry.getMacAddress().getValue(), macEntry.getIpPrefix().getIpv4Address().getValue(), interfaceInfo.getInterfaceName(), interfaceInfo.getDpId());
});
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface in project netvirt by opendaylight.
the class HwvtepTerminationPointListener method getVlanBindings.
private List<VlanBindings> getVlanBindings(List<L2gatewayConnection> l2GwConns, NodeId hwvtepNodeId, String psName, String newPortId) {
List<VlanBindings> vlanBindings = new ArrayList<>();
for (L2gatewayConnection l2GwConn : l2GwConns) {
L2gateway l2Gateway = L2GatewayConnectionUtils.getNeutronL2gateway(broker, l2GwConn.getL2gatewayId());
if (l2Gateway == null) {
LOG.error("L2Gateway with id {} is not present", l2GwConn.getL2gatewayId().getValue());
} else {
String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(l2GwConn.getNetworkId().getValue());
List<Devices> l2Devices = l2Gateway.getDevices();
for (Devices l2Device : l2Devices) {
String l2DeviceName = l2Device.getDeviceName();
if (l2DeviceName != null && l2DeviceName.equals(psName)) {
for (Interfaces deviceInterface : l2Device.getInterfaces()) {
if (deviceInterface.getInterfaceName().equals(newPortId)) {
if (deviceInterface.getSegmentationIds() != null && !deviceInterface.getSegmentationIds().isEmpty()) {
for (Integer vlanId : deviceInterface.getSegmentationIds()) {
vlanBindings.add(HwvtepSouthboundUtils.createVlanBinding(hwvtepNodeId, vlanId, logicalSwitchName));
}
} else {
// Use defaultVlanId (specified in L2GatewayConnection) if Vlan
// ID not specified at interface level.
Integer segmentationId = l2GwConn.getSegmentId();
int defaultVlanId = segmentationId != null ? segmentationId : 0;
vlanBindings.add(HwvtepSouthboundUtils.createVlanBinding(hwvtepNodeId, defaultVlanId, logicalSwitchName));
}
}
}
}
}
}
}
return vlanBindings;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.endpoint.endpoint.type.Interface in project netvirt by opendaylight.
the class ElanBridgeManager method prepareIntegrationBridge.
private void prepareIntegrationBridge(Node ovsdbNode, Node brIntNode) {
if (southboundUtils.getBridgeFromConfig(ovsdbNode, INTEGRATION_BRIDGE) == null) {
LOG.debug("br-int in operational but not config, copying into config");
copyBridgeToConfig(brIntNode);
}
Map<String, String> providerMappings = getOpenvswitchOtherConfigMap(ovsdbNode, PROVIDER_MAPPINGS_KEY);
for (String value : providerMappings.values()) {
if (southboundUtils.extractTerminationPointAugmentation(brIntNode, value) != null) {
LOG.debug("prepareIntegrationBridge: port {} already exists on {}", value, INTEGRATION_BRIDGE);
continue;
}
Node exBridgeNode = southboundUtils.readBridgeNode(ovsdbNode, value);
if (exBridgeNode != null) {
LOG.debug("prepareIntegrationBridge: bridge {} found. Patching to {}", value, INTEGRATION_BRIDGE);
patchBridgeToBrInt(brIntNode, exBridgeNode, value);
} else {
LOG.debug("prepareIntegrationBridge: adding interface {} to {}", value, INTEGRATION_BRIDGE);
if (!addPortToBridge(brIntNode, INTEGRATION_BRIDGE, value)) {
LOG.error("Failed to add {} port to {}", value, brIntNode);
}
}
}
if (!addControllerToBridge(ovsdbNode, INTEGRATION_BRIDGE)) {
LOG.error("Failed to set controller to existing integration bridge {}", brIntNode);
}
}
Aggregations