use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.
the class VrfEntryListener method removeFibEntries.
// This method is temporary. Eventually Factory design pattern will be used to get
// right VrfEntryhandle and invoke its methods.
private void removeFibEntries(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
if (VrfEntry.EncapType.Vxlan.equals(vrfEntry.getEncapType())) {
LOG.info("EVPN flows to be deleted");
EvpnVrfEntryHandler evpnVrfEntryHandler = new EvpnVrfEntryHandler(dataBroker, this, bgpRouteVrfEntryHandler, nextHopManager, jobCoordinator, elanManager, fibUtil);
evpnVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
closeables.add(evpnVrfEntryHandler);
return;
}
RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
if (routerInt != null) {
// ping responder for router interfaces
routerInterfaceVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
return;
}
if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
deleteFibEntries(identifier, vrfEntry);
return;
}
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
bgpRouteVrfEntryHandler.removeFlows(identifier, vrfEntry, rd);
return;
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.
the class VrfEntryListener method addFibEntries.
// This method is temporary. Eventually Factory design pattern will be used to get
// right VrfEntryhandle and invoke its methods.
private void addFibEntries(InstanceIdentifier<VrfEntry> identifier, VrfEntry vrfEntry, String rd) {
if (RouteOrigin.value(vrfEntry.getOrigin()) == RouteOrigin.BGP) {
bgpRouteVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
return;
}
if (VrfEntry.EncapType.Vxlan.equals(vrfEntry.getEncapType())) {
LOG.info("EVPN flows need to be programmed.");
EvpnVrfEntryHandler evpnVrfEntryHandler = new EvpnVrfEntryHandler(dataBroker, this, bgpRouteVrfEntryHandler, nextHopManager, jobCoordinator, elanManager, fibUtil);
evpnVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
closeables.add(evpnVrfEntryHandler);
return;
}
RouterInterface routerInt = vrfEntry.getAugmentation(RouterInterface.class);
if (routerInt != null) {
// ping responder for router interfaces
routerInterfaceVrfEntryHandler.createFlows(identifier, vrfEntry, rd);
return;
}
if (RouteOrigin.value(vrfEntry.getOrigin()) != RouteOrigin.BGP) {
createFibEntries(identifier, vrfEntry);
return;
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.
the class IfMgr method addSubnet.
/**
* Add Subnet.
*
* @param snetId subnet id
* @param name subnet name
* @param tenantId tenant id
* @param gatewayIp gateway ip address
* @param ipVersion IP Version "IPv4 or IPv6"
* @param subnetCidr subnet CIDR
* @param ipV6AddressMode Address Mode of IPv6 Subnet
* @param ipV6RaMode RA Mode of IPv6 Subnet.
*/
public void addSubnet(Uuid snetId, String name, Uuid tenantId, IpAddress gatewayIp, String ipVersion, IpPrefix subnetCidr, String ipV6AddressMode, String ipV6RaMode) {
// in expanded form and are used during Neighbor Discovery Support.
if (gatewayIp != null) {
Ipv6Address addr = new Ipv6Address(InetAddresses.forString(gatewayIp.getIpv6Address().getValue()).getHostAddress());
gatewayIp = new IpAddress(addr);
}
VirtualSubnet snet = VirtualSubnet.builder().subnetUUID(snetId).tenantID(tenantId).name(name).gatewayIp(gatewayIp).subnetCidr(subnetCidr).ipVersion(ipVersion).ipv6AddressMode(ipV6AddressMode).ipv6RAMode(ipV6RaMode).build();
vsubnets.put(snetId, snet);
List<VirtualPort> intfList = unprocessedSubnetIntfs.remove(snetId);
if (intfList == null) {
LOG.debug("No unprocessed interfaces for the subnet {}", snetId);
return;
}
synchronized (intfList) {
for (VirtualPort intf : intfList) {
if (intf != null) {
intf.setSubnet(snetId, snet);
snet.addInterface(intf);
VirtualRouter rtr = intf.getRouter();
if (rtr != null) {
rtr.addSubnet(snet);
}
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.
the class Ipv6NdUtilServiceImpl method sendNeighborSolicitation.
@Override
public Future<RpcResult<Void>> sendNeighborSolicitation(SendNeighborSolicitationInput ndInput) {
RpcResultBuilder<Void> failureBuilder = RpcResultBuilder.failed();
RpcResultBuilder<Void> successBuilder = RpcResultBuilder.success();
Ipv6Address targetIpv6Address = null;
Ipv6Address srcIpv6Address;
String interfaceName = null;
String macAddr = null;
BigInteger dpnId;
int localErrorCount = 0;
targetIpv6Address = ndInput.getTargetIpAddress();
for (InterfaceAddress interfaceAddress : ndInput.getInterfaceAddress()) {
try {
interfaceName = interfaceAddress.getInterface();
srcIpv6Address = interfaceAddress.getSrcIpAddress();
GetPortFromInterfaceOutput portResult = getPortFromInterface(interfaceName);
checkNotNull(portResult);
dpnId = portResult.getDpid();
Long portid = portResult.getPortno();
checkArgument(null != dpnId && BigInteger.ZERO != dpnId, DPN_NOT_FOUND_ERROR, interfaceName);
NodeConnectorRef nodeRef = MDSALUtil.getNodeConnRef(dpnId, portid.toString());
checkNotNull(nodeRef, NODE_CONNECTOR_NOT_FOUND_ERROR, interfaceName);
if (interfaceAddress.getSrcMacAddress() != null) {
macAddr = interfaceAddress.getSrcMacAddress().getValue();
}
checkNotNull(macAddr, FAILED_TO_GET_SRC_MAC_FOR_INTERFACE, interfaceName, nodeRef.getValue());
ipv6NeighborSolicitation.transmitNeighborSolicitation(dpnId, nodeRef, new MacAddress(macAddr), srcIpv6Address, targetIpv6Address);
} catch (NullPointerException | IllegalArgumentException e) {
LOG.trace("Failed to send Neighbor Solicitation for {} on interface {}", ndInput.getTargetIpAddress(), interfaceName);
failureBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE + interfaceName, e);
successBuilder.withError(RpcError.ErrorType.APPLICATION, FAILED_TO_SEND_NS_FOR_INTERFACE + interfaceName, e);
localErrorCount++;
}
}
if (localErrorCount == ndInput.getInterfaceAddress().size()) {
// Failed to send IPv6 Neighbor Solicitation on all the interfaces, return failure.
return Futures.immediateFuture(failureBuilder.build());
}
return Futures.immediateFuture(successBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces in project netvirt by opendaylight.
the class AclInstanceRecoveryHandler method recoverService.
@Override
public void recoverService(String entityId) {
LOG.info("Recover ACL instance {}", entityId);
Uuid aclId = new Uuid(entityId);
Collection<AclInterface> aclInterfaces = aclDataUtil.getInterfaceList(aclId);
for (AclInterface aclInterface : aclInterfaces) {
String aclInterfaceId = aclInterface.getInterfaceId();
Optional<Interface> interfaceOptional = AclServiceUtils.getInterface(dataBroker, aclInterfaceId);
if (interfaceOptional.isPresent()) {
Interface interfaceBefore = interfaceOptional.get();
LOG.debug("Starting Recovery of acl Instance {} for interface {}", entityId, interfaceBefore.getName());
InterfaceAcl interfaceAclBefore = interfaceBefore.getAugmentation(InterfaceAcl.class);
List<Uuid> sgList = new ArrayList<>(interfaceAclBefore.getSecurityGroups());
sgList.remove(aclId);
InterfaceAcl interfaceAclAfter = new InterfaceAclBuilder(interfaceAclBefore).setSecurityGroups(sgList).build();
Interface interfaceAfter = new InterfaceBuilder(interfaceBefore).addAugmentation(InterfaceAcl.class, interfaceAclAfter).build();
aclInterfaceListener.update(null, interfaceBefore, interfaceAfter);
aclInterfaceListener.update(null, interfaceAfter, interfaceBefore);
} else {
LOG.error("Interfaces not present for aclInterface {} ", aclInterfaceId);
}
}
}
Aggregations