use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron in project netvirt by opendaylight.
the class ConfigurationClassifierImpl method getEntriesForAce.
private Set<ClassifierRenderableEntry> getEntriesForAce(Ace ace) {
String ruleName = ace.getRuleName();
LOG.debug("Generating classifier entries for Ace: {}", ruleName);
LOG.trace("Ace details: {}", ace);
Optional<NetvirtsfcAclActions> sfcActions = Optional.ofNullable(ace.getActions()).map(actions -> actions.getAugmentation(RedirectToSfc.class));
String rspName = sfcActions.map(NetvirtsfcAclActions::getRspName).map(Strings::emptyToNull).orElse(null);
String sfpName = sfcActions.map(NetvirtsfcAclActions::getSfpName).map(Strings::emptyToNull).orElse(null);
if (rspName == null && sfpName == null) {
LOG.debug("Ace {} ignored: no valid SFC redirect action", ruleName);
return Collections.emptySet();
}
if (rspName != null && sfpName != null) {
LOG.warn("Ace {} ignored: both SFP and a RSP as redirect actions not supported", ruleName);
return Collections.emptySet();
}
Matches matches = ace.getMatches();
if (matches == null) {
LOG.warn("Ace {} ignored: no matches", ruleName);
return Collections.emptySet();
}
NeutronNetwork network = matches.getAugmentation(NeutronNetwork.class);
if (sfpName != null && network != null) {
LOG.warn("Ace {} ignored: SFP redirect action with neutron network match not supported", ruleName);
return Collections.emptySet();
}
String sourcePort = Optional.ofNullable(matches.getAugmentation(NeutronPorts.class)).map(NeutronPorts::getSourcePortUuid).map(Strings::emptyToNull).orElse(null);
String destinationPort = Optional.ofNullable(matches.getAugmentation(NeutronPorts.class)).map(NeutronPorts::getDestinationPortUuid).map(Strings::emptyToNull).orElse(null);
if (rspName != null) {
return getEntriesForRspRedirect(ruleName, sourcePort, destinationPort, network, rspName, matches);
}
return getEntriesForSfpRedirect(ruleName, sourcePort, destinationPort, sfpName, matches);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron in project lispflowmapping by opendaylight.
the class PortDataProcessor method update.
@Override
public void update(Port port) {
final String hostId = port.getAugmentation(PortBindingExtension.class).getHostId();
if (hostId == null) {
LOG.error("Updating port to lisp mapping service failed. Port does not have a HostID. Port: {}", port.toString());
return;
}
List<FixedIps> fixedIPs = port.getFixedIps();
if (fixedIPs != null && fixedIPs.size() > 0) {
Eid eidAddress;
for (FixedIps ip : fixedIPs) {
eidAddress = getEid(port, ip);
PortData portData = new PortData(port.getUuid().getValue(), eidAddress);
hostInformationManager.addHostRelatedInfo(hostId, portData);
}
}
LOG.info("Neutron Port updated: Port name: " + port.getName() + " Port Fixed IP: " + (port.getFixedIps() != null ? port.getFixedIps().get(0) : "No Fixed IP assigned"));
LOG.debug("Neutron Port Updated : " + port.toString());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron in project lispflowmapping by opendaylight.
the class PortDataProcessor method delete.
@Override
public void delete(Port port) {
// TODO if port ips existed in MapServer, delete them. Else, log error.
LOG.info("Neutron Port Deleted: Port name: " + port.getName() + " Port Fixed IP: " + (port.getFixedIps() != null ? port.getFixedIps().get(0) : "No Fixed IP assigned"));
LOG.debug("Neutron Port Deleted : " + port.toString());
List<FixedIps> fixedIPs = port.getFixedIps();
if (fixedIPs != null && fixedIPs.size() > 0) {
Eid eidAddress;
for (FixedIps ip : fixedIPs) {
// TODO Add check/support for IPv6.
// Get subnet for this port, based on v4 or v6 decide address
// iana code.
eidAddress = LispAddressUtil.asIpv4PrefixEid(ip.getIpAddress().getIpv4Address().getValue() + "/32");
lispNeutronService.getMappingDbService().removeMapping(LispUtil.buildRemoveMappingInput(eidAddress));
LOG.info("Neutron Port mapping deleted from lisp: " + " Port Fixed IP: " + ip + "Port host IP: ");
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron in project lispflowmapping by opendaylight.
the class SubnetDataProcessor method create.
/**
* Method adds the newly created subnet as an EID prefix to the
* MappingService. The subnet's network UUID is used as the key for this EID
* prefix.
*/
@Override
public void create(Subnet subnet) {
// TODO update for multi-tenancy
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
LOG.debug("Lisp Neutron Subnet: " + subnet.toString());
// Determine the IANA code for the subnet IP version
// Default is set to IPv4 for neutron subnets
final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
try {
final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();
if (lfmdb == null) {
LOG.debug("lfmdb is null!!!");
return;
}
final AddKeyInput addKeyInput = LispUtil.buildAddKeyInput(eid, subnet.getUuid().getValue());
final Future<RpcResult<Void>> result = lfmdb.addKey(addKeyInput);
final Boolean isSuccessful = result.get().isSuccessful();
if (isSuccessful) {
LOG.debug("Neutron Subnet Added to MapServer : Subnet name: " + subnet.getName() + " EID Prefix: " + subnet.getCidr() + " Key: " + subnet.getUuid());
}
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
} catch (InterruptedException | ExecutionException e) {
LOG.error("Adding new subnet to lisp service mapping service failed. Subnet : " + subnet.toString() + "Error: " + ExceptionUtils.getStackTrace(e));
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron in project netvirt by opendaylight.
the class L2GatewayConnectionUtils method addL2GatewayConnection.
public void addL2GatewayConnection(final L2gatewayConnection input, final String l2GwDeviceName, L2gateway l2Gateway) {
LOG.info("Adding L2gateway Connection with ID: {}", input.getKey().getUuid());
Uuid networkUuid = input.getNetworkId();
// Taking cluster reboot scenario , if Elan instance is not available when l2GatewayConnection add events
// comes we need to wait for elaninstance to resolve. Hence updating the map with the runnable .
// When elanInstance add comes , it look in to the map and run the associated runnable associated with it.
ElanInstance elanInstance = elanInstanceCache.get(networkUuid.getValue(), () -> addL2GatewayConnection(input, l2GwDeviceName)).orNull();
if (elanInstance == null) {
return;
}
if (!isVxlanNetworkOrVxlanSegment(elanInstance)) {
LOG.error("Neutron network with id {} is not VxlanNetwork", networkUuid.getValue());
} else {
Uuid l2GatewayId = input.getL2gatewayId();
if (l2Gateway == null) {
l2Gateway = getNeutronL2gateway(broker, l2GatewayId);
}
if (l2Gateway == null) {
LOG.error("L2Gateway with id {} is not present", l2GatewayId.getValue());
} else {
associateHwvtepsToElan(elanInstance, l2Gateway, input, l2GwDeviceName);
}
}
}
Aggregations