private class FakeOF10Provider implements NetworkingProvider {
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public boolean supportsServices() {
+ return false;
+ }
+
@Override
public boolean hasPerTenantTunneling() {
return true;
private class FakeOF13Provider implements NetworkingProvider {
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public boolean supportsServices() {
+ return false;
+ }
+
@Override
public boolean hasPerTenantTunneling() {
return false;
import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
+import org.opendaylight.ovsdb.openstack.netvirt.api.InboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.L3ForwardingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OutboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow10.OF10Provider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.IngressAclService;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L2ForwardingService;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L2RewriteService;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.L3ForwardingService;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.LoadBalancerService;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.OutboundNatService;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services.RoutingService;
IngressAclService.class,
LoadBalancerService.class,
RoutingService.class,
+ L3ForwardingService.class,
L2RewriteService.class,
L2ForwardingService.class,
EgressAclService.class,
if (imp.equals(ClassifierService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.CLASSIFIER);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(ArpResponderService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.ARP_RESPONDER);
- c.setInterface(AbstractServiceInstance.class.getName(), properties);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
+ c.setInterface(new String[] {AbstractServiceInstance.class.getName(), ArpProvider.class.getName()},
+ properties);
}
if (imp.equals(InboundNatService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INBOUND_NAT);
- c.setInterface(AbstractServiceInstance.class.getName(), properties);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
+ c.setInterface(new String[] {AbstractServiceInstance.class.getName(), InboundNatProvider.class.getName()},
+ properties);
}
if (imp.equals(IngressAclService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INGRESS_ACL);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(LoadBalancerService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.LOAD_BALANCER);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(RoutingService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.ROUTING);
- c.setInterface(AbstractServiceInstance.class.getName(), properties);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
+ c.setInterface(new String[] {AbstractServiceInstance.class.getName(), RoutingProvider.class.getName()},
+ properties);
+ }
+
+ if (imp.equals(L3ForwardingService.class)) {
+ Properties properties = new Properties();
+ properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L3_FORWARDING);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
+ c.setInterface(new String[] {AbstractServiceInstance.class.getName(), L3ForwardingProvider.class.getName()},
+ properties);
}
if (imp.equals(L2RewriteService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L2_REWRITE);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(L2ForwardingService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.L2_FORWARDING);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(IngressAclService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.INGRESS_ACL);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
c.setInterface(AbstractServiceInstance.class.getName(), properties);
}
if (imp.equals(OutboundNatService.class)) {
Properties properties = new Properties();
properties.put(AbstractServiceInstance.SERVICE_PROPERTY, Service.OUTBOUND_NAT);
- c.setInterface(AbstractServiceInstance.class.getName(), properties);
+ properties.put(Constants.PROVIDER_NAME_PROPERTY, OF13Provider.NAME);
+ c.setInterface(new String[] {AbstractServiceInstance.class.getName(), OutboundNatProvider.class.getName()},
+ properties);
}
}
}
public OF10Provider(){
}
+ @Override
+ public String getName() {
+ return "OF10Provider";
+ }
+
+ @Override
+ public boolean supportsServices() {
+ return false;
+ }
+
@Override
public boolean hasPerTenantTunneling() {
return true;
private volatile OvsdbConnectionService connectionService;
private volatile MdsalConsumer mdsalConsumer;
+ public static final String NAME = "OF13Provider";
+
public OF13Provider(){
}
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public boolean supportsServices() {
+ return true;
+ }
+
@Override
public boolean hasPerTenantTunneling() {
return false;
INGRESS_ACL ((short) 40, "Ingress Acces-control. Typically Openstack Egress Security group policies are applied here."),
LOAD_BALANCER ((short) 50, "Distributed LBaaS"),
ROUTING ((short) 60, "Distributed Virtual Routing (DVR)"),
- L2_REWRITE ((short) 70, "Layer2 rewrite service"),
- L2_FORWARDING ((short) 80, "Layer2 mac,vlan based forwarding"),
- EGRESS_ACL ((short) 90, "Egress Acces-control.Typically Openstack Ingress Security group policies are applied here."),
- OUTBOUND_NAT ((short) 100, "SNAT for traffic accessing external network");
+ L3_FORWARDING ((short) 70, "Layer 3 forwarding/lookup service"),
+ L2_REWRITE ((short) 80, "Layer2 rewrite service"),
+ L2_FORWARDING ((short) 90, "Layer2 mac,vlan based forwarding"),
+ EGRESS_ACL ((short) 100, "Egress Acces-control.Typically Openstack Ingress Security group policies are applied here."),
+ OUTBOUND_NAT ((short) 110, "SNAT for traffic accessing external network");
short table;
String description;
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
- * Authors : Madhu Venugopal
+ * Authors : Madhu Venugopal, Dave Tucker
*/
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-public class ArpResponderService extends AbstractServiceInstance {
+import java.net.InetAddress;
+
+public class ArpResponderService extends AbstractServiceInstance implements ArpProvider {
public ArpResponderService() {
super(Service.ARP_RESPONDER);
}
public boolean isBridgeInPipeline (String nodeId) {
return true;
}
-}
\ No newline at end of file
+
+ @Override
+ public Status programStaticArpEntry(Node node, Long dpid, String segmentationId, String macAddress,
+ InetAddress ipAddress, Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
- * Authors : Madhu Venugopal
+ * Authors : Madhu Venugopal, Dave Tucker
*/
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.InboundNatProvider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-public class InboundNatService extends AbstractServiceInstance {
+import java.net.InetAddress;
+
+public class InboundNatService extends AbstractServiceInstance implements InboundNatProvider {
public InboundNatService() {
super(Service.INBOUND_NAT);
}
public boolean isBridgeInPipeline (String nodeId) {
return true;
}
-}
\ No newline at end of file
+
+ @Override
+ public Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
+ InetAddress rewriteAddress, Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+
+ @Override
+ public Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId, String excludedCidr,
+ Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.L3ForwardingProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
+import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
+
+import java.net.InetAddress;
+
+public class L3ForwardingService extends AbstractServiceInstance implements L3ForwardingProvider {
+ public L3ForwardingService() {
+ super(Service.L3_FORWARDING);
+ }
+
+ public L3ForwardingService(Service service) {
+ super(service);
+ }
+
+ @Override
+ public boolean isBridgeInPipeline (String nodeId) {
+ return true;
+ }
+
+ @Override
+ public Status programForwardingTableEntry(Node node, Long dpid, String segmentationId, InetAddress ipAddress,
+ String macAddress, Action action) {
+ return null;
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
- * Authors : Madhu Venugopal
+ * Authors : Madhu Venugopal, Dave Tucker
*/
+
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OutboundNatProvider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-public class OutboundNatService extends AbstractServiceInstance {
+import java.net.InetAddress;
+
+public class OutboundNatService extends AbstractServiceInstance implements OutboundNatProvider {
public OutboundNatService() {
super(Service.OUTBOUND_NAT);
}
public boolean isBridgeInPipeline (String nodeId) {
return true;
}
-}
\ No newline at end of file
+
+ @Override
+ public Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
+ InetAddress rewriteAddress, Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+
+ @Override
+ public Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId, String excludedCidr,
+ Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*
- * Authors : Madhu Venugopal
+ * Authors : Madhu Venugopal, Dave Tucker
*/
+
package org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.services;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.AbstractServiceInstance;
import org.opendaylight.ovsdb.openstack.netvirt.providers.openflow13.Service;
-public class RoutingService extends AbstractServiceInstance {
+import java.net.InetAddress;
+
+public class RoutingService extends AbstractServiceInstance implements RoutingProvider {
public RoutingService() {
super(Service.ROUTING);
}
public boolean isBridgeInPipeline (String nodeId) {
return true;
}
-}
\ No newline at end of file
+
+ @Override
+ public Status programRouterInterface(Node node, Long dpid, String segmentationId, String macAddress,
+ InetAddress address, int mask, Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+
+ @Override
+ public Status programDefaultRouteEntry(Node node, Long dpid, String segmentationId, String macAddress,
+ InetAddress nextHop, Action action) {
+ return new Status(StatusCode.NOTIMPLEMENTED);
+ }
+}
package org.opendaylight.ovsdb.openstack.netvirt;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+
/**
* Abstract class for events used by neutron northbound and southbound events.
*/
public static final int size = HandlerType.values().length;
}
- public enum Action { ADD, UPDATE, DELETE }
private HandlerType handlerType;
private Action action;
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
import org.opendaylight.controller.switchmanager.IInventoryListener;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher;
+import org.opendaylight.ovsdb.openstack.netvirt.api.InboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.L3ForwardingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantAwareRouter;
-import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantRouterForwardingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OutboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.VlanConfigurationCache;
import org.opendaylight.ovsdb.openstack.netvirt.impl.BridgeConfigurationManagerImpl;
c.add(createServiceDependency().setService(INeutronSubnetCRUD.class).setRequired(true));
c.add(createServiceDependency().setService(INeutronPortCRUD.class).setRequired(true));
c.add(createServiceDependency().setService(MultiTenantAwareRouter.class).setRequired(true));
- // TODO: it should require MultiTenantRouterForwardingProvider
- c.add(createServiceDependency().setService(MultiTenantRouterForwardingProvider.class).setRequired(false));
+ /* ToDo, we should probably just use the NetworkingProvider interface
+ * This should provide a way of getting service implementations
+ * Either that, or we should do service lookup at runtime based on getProvider().getName()
+ * This is a shortcut as for now there will only be one implementation of these classes.
+ */
+ c.add(createServiceDependency().setService(MultiTenantAwareRouter.class).setRequired(false));
+ c.add(createServiceDependency().setService(ArpProvider.class).setRequired(false));
+ c.add(createServiceDependency().setService(InboundNatProvider.class).setRequired(false));
+ c.add(createServiceDependency().setService(OutboundNatProvider.class).setRequired(false));
+ c.add(createServiceDependency().setService(RoutingProvider.class).setRequired(false));
+ c.add(createServiceDependency().setService(L3ForwardingProvider.class).setRequired(false));
}
if (imp.equals(OpenstackRouter.class)) {
import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware;
import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
import org.slf4j.Logger;
*/
@Override
public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP) {
- enqueueEvent(new NorthboundEvent(floatingIP, AbstractEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(floatingIP, Action.ADD));
}
/**
*/
@Override
public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP) {
- enqueueEvent(new NorthboundEvent(floatingIP, AbstractEvent.Action.UPDATE));
+ enqueueEvent(new NorthboundEvent(floatingIP, Action.UPDATE));
}
/**
*/
@Override
public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP) {
- enqueueEvent(new NorthboundEvent(floatingIP, AbstractEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(floatingIP, Action.DELETE));
}
/**
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
return;
}
- enqueueEvent(new NorthboundEvent(network, AbstractEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(network, Action.ADD));
}
private void doNeutronNetworkCreated(NeutronNetwork network) {
- neutronL3Adapter.handleNeutronNetworkEvent(network, AbstractEvent.Action.ADD);
+ neutronL3Adapter.handleNeutronNetworkEvent(network, Action.ADD);
}
/**
*/
@Override
public void neutronNetworkUpdated(NeutronNetwork network) {
- enqueueEvent(new NorthboundEvent(network, AbstractEvent.Action.UPDATE));
+ enqueueEvent(new NorthboundEvent(network, Action.UPDATE));
}
private void doNeutronNetworkUpdated(NeutronNetwork network) {
- neutronL3Adapter.handleNeutronNetworkEvent(network, AbstractEvent.Action.UPDATE);
+ neutronL3Adapter.handleNeutronNetworkEvent(network, Action.UPDATE);
}
/**
*/
@Override
public void neutronNetworkDeleted(NeutronNetwork network) {
- enqueueEvent(new NorthboundEvent(network, AbstractEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(network, Action.DELETE));
}
private void doNeutronNetworkDeleted(NeutronNetwork network) {
- neutronL3Adapter.handleNeutronNetworkEvent(network, AbstractEvent.Action.DELETE);
+ neutronL3Adapter.handleNeutronNetworkEvent(network, Action.DELETE);
int result = canDeleteNetwork(network);
logger.trace("canDeleteNetwork: network: {}", network);
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
public class NorthboundEvent extends AbstractEvent {
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.api.Constants;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
return;
}
- enqueueEvent(new NorthboundEvent(neutronPort, NorthboundEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(neutronPort, Action.ADD));
}
private void doNeutronPortCreated(NeutronPort neutronPort) {
logger.debug(" Port-ADD successful for tenant-id - {}," +
" network-id - {}, port-id - {}",
neutronPort.getTenantID(), neutronPort.getNetworkUUID(),
neutronPort.getID());
- neutronL3Adapter.handleNeutronPortEvent(neutronPort, NorthboundEvent.Action.ADD);
+ neutronL3Adapter.handleNeutronPortEvent(neutronPort, Action.ADD);
}
/**
*/
@Override
public void neutronPortUpdated(NeutronPort neutronPort) {
- enqueueEvent(new NorthboundEvent(neutronPort, NorthboundEvent.Action.UPDATE));
+ enqueueEvent(new NorthboundEvent(neutronPort, Action.UPDATE));
}
private void doNeutronPortUpdated(NeutronPort neutronPort) {
logger.debug("Handling neutron update port " + neutronPort);
- neutronL3Adapter.handleNeutronPortEvent(neutronPort, NorthboundEvent.Action.UPDATE);
+ neutronL3Adapter.handleNeutronPortEvent(neutronPort, Action.UPDATE);
}
/**
return;
}
- enqueueEvent(new NorthboundEvent(neutronPort, NorthboundEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(neutronPort, Action.DELETE));
}
private void doNeutronPortDeleted(NeutronPort neutronPort) {
logger.debug("Handling neutron delete port " + neutronPort);
- neutronL3Adapter.handleNeutronPortEvent(neutronPort, NorthboundEvent.Action.DELETE);
+ neutronL3Adapter.handleNeutronPortEvent(neutronPort, Action.DELETE);
List<Node> nodes = connectionService.getNodes();
for (Node node : nodes) {
import org.opendaylight.controller.networkconfig.neutron.INeutronRouterAware;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter;
import org.opendaylight.controller.networkconfig.neutron.NeutronRouter_Interface;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
import org.slf4j.Logger;
*/
@Override
public void neutronRouterCreated(NeutronRouter router) {
- enqueueEvent(new NorthboundEvent(router, AbstractEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(router, Action.ADD));
}
/**
*/
@Override
public void neutronRouterUpdated(NeutronRouter router) {
- enqueueEvent(new NorthboundEvent(router, AbstractEvent.Action.UPDATE));
+ enqueueEvent(new NorthboundEvent(router, Action.UPDATE));
}
/**
*/
@Override
public void neutronRouterDeleted(NeutronRouter router) {
- enqueueEvent(new NorthboundEvent(router, AbstractEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(router, Action.DELETE));
}
/**
*/
@Override
public void neutronRouterInterfaceAttached(NeutronRouter router, NeutronRouter_Interface routerInterface) {
- enqueueEvent(new NorthboundEvent(router, routerInterface, AbstractEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(router, routerInterface, Action.ADD));
}
/**
*/
@Override
public void neutronRouterInterfaceDetached(NeutronRouter router, NeutronRouter_Interface routerInterface) {
- enqueueEvent(new NorthboundEvent(router, routerInterface, AbstractEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(router, routerInterface, Action.DELETE));
}
/**
import org.opendaylight.controller.sal.core.Node;
import org.opendaylight.ovsdb.lib.notation.Row;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
public class SouthboundEvent extends AbstractEvent {
public enum Type { NODE, ROW };
import org.opendaylight.controller.switchmanager.IInventoryListener;
import org.opendaylight.ovsdb.lib.notation.Row;
import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
@Override
public void nodeAdded(Node node, InetAddress address, int port) {
- this.enqueueEvent(new SouthboundEvent(node, SouthboundEvent.Action.ADD));
+ this.enqueueEvent(new SouthboundEvent(node, Action.ADD));
}
@Override
public void nodeRemoved(Node node) {
- this.enqueueEvent(new SouthboundEvent(node, SouthboundEvent.Action.DELETE));
+ this.enqueueEvent(new SouthboundEvent(node, Action.DELETE));
}
@Override
public void rowAdded(Node node, String tableName, String uuid, Row row) {
- this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, SouthboundEvent.Action.ADD));
+ this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, Action.ADD));
}
@Override
public void rowUpdated(Node node, String tableName, String uuid, Row oldRow, Row newRow) {
if (this.isUpdateOfInterest(node, oldRow, newRow)) {
- this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, newRow, SouthboundEvent.Action.UPDATE));
+ this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, newRow, Action.UPDATE));
}
}
@Override
public void rowRemoved(Node node, String tableName, String uuid, Row row, Object context) {
- this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, context, SouthboundEvent.Action.DELETE));
+ this.enqueueEvent(new SouthboundEvent(node, tableName, uuid, row, context, Action.DELETE));
}
- public void processNodeUpdate(Node node, SouthboundEvent.Action action) {
- if (action == SouthboundEvent.Action.DELETE) return;
+ public void processNodeUpdate(Node node, Action action) {
+ if (action == Action.DELETE) return;
logger.trace("Process Node added {}", node);
bridgeConfigurationManager.prepareNode(node);
}
private void processRowUpdate(Node node, String tableName, String uuid, Row row,
- Object context, SouthboundEvent.Action action) {
- if (action == SouthboundEvent.Action.DELETE) {
+ Object context, Action action) {
+ if (action == Action.DELETE) {
if (tableName.equalsIgnoreCase(ovsdbConfigurationService.getTableName(node, Interface.class))) {
logger.debug("Processing update of {}. Deleted node: {}, uuid: {}, row: {}", tableName, node, uuid, row);
Interface deletedIntf = ovsdbConfigurationService.getTypedRow(node, Interface.class, row);
logger.trace("Interface update of node: {}, uuid: {}", node, uuid);
NeutronNetwork network = tenantNetworkManager.getTenantNetwork(intf);
if (network != null) {
- neutronL3Adapter.handleInterfaceEvent(node, intf, network, AbstractEvent.Action.UPDATE);
+ neutronL3Adapter.handleInterfaceEvent(node, intf, network, Action.UPDATE);
if (bridgeConfigurationManager.createLocalNetwork(node, network))
networkingProviderManager.getProvider(node).handleInterfaceUpdate(network, node, intf);
} else {
logger.debug("handleInterfaceDelete: node: {}, uuid: {}, isLastInstanceOnNode: {}, interface: {}",
node, uuid, isLastInstanceOnNode, intf);
- neutronL3Adapter.handleInterfaceEvent(node, intf, network, AbstractEvent.Action.DELETE);
+ neutronL3Adapter.handleInterfaceEvent(node, intf, network, Action.DELETE);
List<String> phyIfName = bridgeConfigurationManager.getAllPhysicalInterfaceNames(node);
if (intf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VXLAN) ||
intf.getTypeColumn().getData().equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) ||
import org.opendaylight.controller.networkconfig.neutron.INeutronSubnetAware;
import org.opendaylight.controller.networkconfig.neutron.NeutronSubnet;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.impl.NeutronL3Adapter;
import com.google.common.base.Preconditions;
@Override
public void neutronSubnetCreated(NeutronSubnet subnet) {
- enqueueEvent(new NorthboundEvent(subnet, NorthboundEvent.Action.ADD));
+ enqueueEvent(new NorthboundEvent(subnet, Action.ADD));
}
@Override
@Override
public void neutronSubnetUpdated(NeutronSubnet subnet) {
- enqueueEvent(new NorthboundEvent(subnet, NorthboundEvent.Action.UPDATE));
+ enqueueEvent(new NorthboundEvent(subnet, Action.UPDATE));
}
@Override
@Override
public void neutronSubnetDeleted(NeutronSubnet subnet) {
- enqueueEvent(new NorthboundEvent(subnet, NorthboundEvent.Action.DELETE));
+ enqueueEvent(new NorthboundEvent(subnet, Action.DELETE));
}
/**
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+/**
+ * This enumeration represents the type of action being perfomed
+ */
+public enum Action {
+ ADD,
+ UPDATE,
+ DELETE
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+
+import java.net.InetAddress;
+
+/**
+ * This interface allows ARP flows to be written to devices
+ */
+public interface ArpProvider {
+
+ Status programStaticArpEntry(Node node, Long dpid, String segmentationId,
+ String macAddress, InetAddress ipAddress, Action action);
+
+}
public static final String PROVIDER_TYPE_PROPERTY = "providerType";
public static final String OPENFLOW_VERSION_PROPERTY = "openflowVersion";
public static final String EVENT_HANDLER_TYPE_PROPERTY = "eventHandlerType";
+ public static final String PROVIDER_NAME_PROPERTY = "providerName";
+ public static final String NAT_PROVIDER_DIRECTION = "natDirection";
}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+
+import java.net.InetAddress;
+
+/**
+ * This interface allows NAT flows to be written to devices
+ */
+public interface InboundNatProvider {
+ Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
+ InetAddress rewriteAddress, Action action);
+
+ Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId,
+ String excludedCidr, Action action);
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+
+import java.net.InetAddress;
+
+/**
+ * This interface allows L3 Forwarding flows to be written to devices
+ */
+public interface L3ForwardingProvider {
+
+ Status programForwardingTableEntry(Node node, Long dpid, String segmentationId, InetAddress ipAddress,
+ String macAddress, Action action);
+
+}
+++ /dev/null
-/*
- * Copyright (C) 2014 Red Hat, Inc.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Dave Tucker, Flavio Fernandes
- */
-
-package org.opendaylight.ovsdb.openstack.netvirt.api;
-
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.ovsdb.openstack.netvirt.AbstractEvent;
-
-import java.net.InetAddress;
-
-/**
- * A MultiTenantForwardingProvider provides Multi-Tenant L3 Forwarding
- */
-public interface MultiTenantRouterForwardingProvider {
-
- Status programStaticArpEntry(Node node, Long dpid, String segmentationId,
- String macAddress, InetAddress ipAddress, AbstractEvent.Action action);
-
- Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
- InetAddress rewriteAddress, AbstractEvent.Action action);
-
- Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId,
- String excludedCidr, AbstractEvent.Action action);
-
- Status programRouterInterface(Node node, Long dpid, String segmentationId, String macAddress,
- InetAddress address, int mask, AbstractEvent.Action action);
-
- Status programForwardingTableEntry(Node node, Long dpid, String segmentationId, InetAddress ipAddress,
- String macAddress, AbstractEvent.Action action);
-
- Status programDefaultRouteEntry(Node node, Long dpid, String segmentationId, String macAddress,
- InetAddress nextHop, AbstractEvent.Action action);
-
-}
*/
public interface NetworkingProvider {
+ /**
+ * Returns the name of the NetworkingProvider
+ */
+ public String getName();
+
+ /**
+ * Return true if the provider supports Network Service Instances
+ */
+ public boolean supportsServices();
+
/**
* Return true if the provider supports per-tenant or "static" tunneling
*/
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+
+import java.net.InetAddress;
+
+/**
+ * This interface allows NAT flows to be written to devices
+ */
+public interface OutboundNatProvider {
+ Status programIpRewriteRule(Node node, Long dpid, String segmentationId, InetAddress matchAddress,
+ InetAddress rewriteAddress, Action action);
+
+ Status programIpRewriteExclusion(Node node, Long dpid, String segmentationId,
+ String excludedCidr, Action action);
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Authors : Dave Tucker, Flavio Fernandes
+ */
+
+package org.opendaylight.ovsdb.openstack.netvirt.api;
+
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.Status;
+
+import java.net.InetAddress;
+
+/**
+ * This interface allows Routing flows to be written to devices
+ */
+public interface RoutingProvider {
+
+ Status programRouterInterface(Node node, Long dpid, String segmentationId, String macAddress,
+ InetAddress address, int mask, Action action);
+
+ Status programDefaultRouteEntry(Node node, Long dpid, String segmentationId, String macAddress,
+ InetAddress nextHop, Action action);
+
+}
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;
import org.opendaylight.ovsdb.lib.notation.Row;
-import org.opendaylight.ovsdb.openstack.netvirt.AbstractEvent;
-import org.opendaylight.ovsdb.openstack.netvirt.NorthboundEvent;
import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantAwareRouter;
-import org.opendaylight.ovsdb.openstack.netvirt.api.MultiTenantRouterForwardingProvider;
import org.opendaylight.ovsdb.openstack.netvirt.api.NetworkingProviderManager;
import org.opendaylight.ovsdb.openstack.netvirt.api.TenantNetworkManager;
import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
import org.opendaylight.ovsdb.schema.openvswitch.Bridge;
+import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
+import org.opendaylight.ovsdb.openstack.netvirt.api.ArpProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.InboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.L3ForwardingProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.OutboundNatProvider;
+import org.opendaylight.ovsdb.openstack.netvirt.api.RoutingProvider;
import org.opendaylight.ovsdb.schema.openvswitch.Interface;
import com.google.common.base.Preconditions;
private volatile INeutronSubnetCRUD neutronSubnetCache;
private volatile INeutronPortCRUD neutronPortCache;
private volatile MultiTenantAwareRouter multiTenantAwareRouter;
- private volatile MultiTenantRouterForwardingProvider multiTenantRouterForwardingProvider;
+ private volatile L3ForwardingProvider l3ForwardingProvider;
+ private volatile InboundNatProvider inboundNatProvider;
+ private volatile OutboundNatProvider outboundNatProvider;
+ private volatile ArpProvider arpProvider;
+ private volatile RoutingProvider routingProvider;
private Set<String> ipRewriteCache;
private Set<String> ipRewriteExclusionCache;
// Callbacks from OVSDB's northbound handlers
//
- public void handleNeutronSubnetEvent(final NeutronSubnet subnet, NorthboundEvent.Action action) {
+ public void handleNeutronSubnetEvent(final NeutronSubnet subnet, Action action) {
logger.debug("Neutron subnet {} event : {}", action, subnet.toString());
// TODO
}
- public void handleNeutronPortEvent(final NeutronPort neutronPort, NorthboundEvent.Action action) {
+ public void handleNeutronPortEvent(final NeutronPort neutronPort, Action action) {
logger.debug("Neutron port {} event : {}", action, neutronPort.toString());
// TODO
}
- public void handleNeutronRouterEvent(final NeutronRouter neutronRouter, NorthboundEvent.Action action) {
+ public void handleNeutronRouterEvent(final NeutronRouter neutronRouter, Action action) {
logger.debug("Neutron router {} event : {}", action, neutronRouter.toString());
// TODO
public void handleNeutronRouterInterfaceEvent(final NeutronRouter neutronRouter,
final NeutronRouter_Interface neutronRouterInterface,
- NorthboundEvent.Action action) {
+ Action action) {
logger.debug(" Router {} interface {} got event {}. Subnet {}",
neutronRouter.getName(),
neutronRouterInterface.getPortUUID(),
action,
neutronRouterInterface.getSubnetUUID());
- this.programFlowsForNeutronRouterInterface(neutronRouterInterface, action == AbstractEvent.Action.DELETE);
+ this.programFlowsForNeutronRouterInterface(neutronRouterInterface, action == Action.DELETE);
}
public void handleNeutronFloatingIPEvent(final NeutronFloatingIP neutronFloatingIP,
- NorthboundEvent.Action action) {
+ Action action) {
logger.debug(" Floating IP {} {}<->{}, network uuid {}", action,
neutronFloatingIP.getFixedIPAddress(),
neutronFloatingIP.getFloatingIPAddress(),
neutronFloatingIP.getFloatingNetworkUUID());
- this.programFlowsForFloatingIP(neutronFloatingIP, action == AbstractEvent.Action.DELETE);
+ this.programFlowsForFloatingIP(neutronFloatingIP, action == Action.DELETE);
}
- public void handleNeutronNetworkEvent(final NeutronNetwork neutronNetwork, NorthboundEvent.Action action) {
+ public void handleNeutronNetworkEvent(final NeutronNetwork neutronNetwork, Action action) {
logger.debug("neutronNetwork {}: network: {}", action, neutronNetwork);
// TODO
//
// Callbacks from OVSDB's southbound handler
//
-
public void handleInterfaceEvent(final Node node, final Interface intf, final NeutronNetwork neutronNetwork,
- AbstractEvent.Action action) {
+ Action action) {
logger.debug("southbound interface {} node:{} interface:{}, neutronNetwork:{}",
action, node, intf, neutronNetwork);
//
// Internal helpers
//
-
private void programFlowsForNeutronRouterInterface(final NeutronRouter_Interface neutronRouterInterface,
Boolean isDelete) {
Preconditions.checkNotNull(neutronRouterInterface);
return; // done: go no further w/out all the info needed...
}
- final AbstractEvent.Action action =
- isDelete ? AbstractEvent.Action.DELETE : AbstractEvent.Action.ADD;
+ final Action action =
+ isDelete ? Action.DELETE : Action.ADD;
// Keep cache for finding router's mac from network uuid
//
List<Node> nodes = connectionService.getNodes();
for (Node node : nodes) {
final Long dpid = getDpid(node);
- final AbstractEvent.Action actionForNode =
+ final Action actionForNode =
tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId) ?
- action : AbstractEvent.Action.DELETE;
+ action : Action.DELETE;
for (Neutron_IPs neutronIP : ipList) {
final String ipStr = neutronIP.getIpAddress();
// for the external neutron networks.
//
{
- final AbstractEvent.Action actionForRewriteExclusion =
- isExternal ? AbstractEvent.Action.DELETE : actionForNode;
+ final Action actionForRewriteExclusion =
+ isExternal ? Action.DELETE : actionForNode;
programIpRewriteExclusionStage1(node, dpid, providerSegmentationId, cidr, actionForRewriteExclusion);
}
// Default route. For non-external subnets, make sure that there is none configured.
//
if (gatewayIp != null && !gatewayIp.isEmpty()) {
- final AbstractEvent.Action actionForNodeDefaultRoute =
- isExternal ? actionForNode : AbstractEvent.Action.DELETE;
+ final Action actionForNodeDefaultRoute =
+ isExternal ? actionForNode : Action.DELETE;
final String defaultGatewayMacAddress = "00:01:02:03:04:05"; // FIXME!
programDefaultRouteStage1(node, dpid, providerSegmentationId, defaultGatewayMacAddress, gatewayIp,
actionForNodeDefaultRoute);
private void programRouterInterfaceStage1(Node node, Long dpid, String providerSegmentationId,
String macAddress, String ipStr, int mask,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
// Based on the local cache, figure out whether programming needs to occur. To do this, we
// will look at desired action for node.
//
ipStr + "/" + Integer.toString(mask);
final Boolean isProgrammed = routerInterfacesCache.contains(cacheKey);
- if (actionForNode == AbstractEvent.Action.DELETE && isProgrammed == Boolean.FALSE) return;
- if (actionForNode == AbstractEvent.Action.ADD && isProgrammed == Boolean.TRUE) return;
+ if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) return;
+ if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) return;
Status status = this.programRouterInterfaceStage2(node, dpid, providerSegmentationId,
macAddress, ipStr, mask, actionForNode);
if (status.isSuccess()) {
// Update cache
- if (actionForNode == AbstractEvent.Action.ADD) {
+ if (actionForNode == Action.ADD) {
// TODO: multiTenantAwareRouter.addInterface(UUID.fromString(tenant), ...);
routerInterfacesCache.add(cacheKey);
} else {
private Status programRouterInterfaceStage2(Node node, Long dpid, String providerSegmentationId,
String macAddress,
String address, int mask,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
Status status;
try {
InetAddress inetAddress = InetAddress.getByName(address);
- status = multiTenantRouterForwardingProvider == null ?
+ status = routingProvider == null ?
new Status(StatusCode.SUCCESS) :
- multiTenantRouterForwardingProvider
- .programRouterInterface(node, dpid, providerSegmentationId,
- macAddress, inetAddress, mask, actionForNode);
+ routingProvider.programRouterInterface(node, dpid, providerSegmentationId,
+ macAddress, inetAddress, mask, actionForNode);
} catch (UnknownHostException e) {
status = new Status(StatusCode.BADREQUEST);
}
if (status.isSuccess()) {
logger.debug("ProgramRouterInterface {} for mac:{} addr:{}/{} node:{} action:{}",
- multiTenantRouterForwardingProvider == null ? "skipped" : "programmed",
+ routingProvider == null ? "skipped" : "programmed",
macAddress, address, mask, node, actionForNode);
} else {
logger.error("ProgramRouterInterface failed for mac:{} addr:{}/{} node:{} action:{} status:{}",
private void programStaticArpStage1(Node node, Long dpid, String providerSegmentationId,
String macAddress, String ipStr,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
// Based on the local cache, figure out whether programming needs to occur. To do this, we
// will look at desired action for node.
//
final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + ipStr;
final Boolean isProgrammed = staticArpEntryCache.contains(cacheKey);
- if (actionForNode == AbstractEvent.Action.DELETE && isProgrammed == Boolean.FALSE) return;
- if (actionForNode == AbstractEvent.Action.ADD && isProgrammed == Boolean.TRUE) return;
+ if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) return;
+ if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) return;
Status status = this.programStaticArpStage2(node, dpid, providerSegmentationId,
macAddress, ipStr, actionForNode);
if (status.isSuccess()) {
// Update cache
- if (actionForNode == AbstractEvent.Action.ADD) {
+ if (actionForNode == Action.ADD) {
staticArpEntryCache.add(cacheKey);
} else {
staticArpEntryCache.remove(cacheKey);
private Status programStaticArpStage2(Node node, Long dpid, String providerSegmentationId,
String macAddress,
String address,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
Status status;
try {
InetAddress inetAddress = InetAddress.getByName(address);
- status = multiTenantRouterForwardingProvider == null ?
+ status = arpProvider == null ?
new Status(StatusCode.SUCCESS) :
- multiTenantRouterForwardingProvider
- .programStaticArpEntry(node, dpid, providerSegmentationId,
- macAddress, inetAddress, actionForNode);
+ arpProvider.programStaticArpEntry(node, dpid, providerSegmentationId,
+ macAddress, inetAddress, actionForNode);
} catch (UnknownHostException e) {
status = new Status(StatusCode.BADREQUEST);
}
if (status.isSuccess()) {
logger.debug("ProgramStaticArp {} for mac:{} addr:{} node:{} action:{}",
- multiTenantRouterForwardingProvider == null ? "skipped" : "programmed",
+ arpProvider == null ? "skipped" : "programmed",
macAddress, address, node, actionForNode);
} else {
logger.error("ProgramStaticArp failed for mac:{} addr:{} node:{} action:{} status:{}",
return status;
}
+ /* ToDo: IP Rewrites have been broken in to two tables
+ As such we need to modify the interfaces to program in to the correct tables
+ */
private void programIpRewriteExclusionStage1(Node node, Long dpid, String providerSegmentationId,
String cidr,
- AbstractEvent.Action actionForRewriteExclusion) {
+ Action actionForRewriteExclusion) {
// Based on the local cache, figure out whether programming needs to occur. To do this, we
// will look at desired action for node.
//
final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + cidr;
final Boolean isProgrammed = ipRewriteExclusionCache.contains(cacheKey);
- if (actionForRewriteExclusion == AbstractEvent.Action.DELETE && isProgrammed == Boolean.FALSE) return;
- if (actionForRewriteExclusion == AbstractEvent.Action.ADD && isProgrammed == Boolean.TRUE) return;
+ if (actionForRewriteExclusion == Action.DELETE && isProgrammed == Boolean.FALSE) return;
+ if (actionForRewriteExclusion == Action.ADD && isProgrammed == Boolean.TRUE) return;
Status status = this.programIpRewriteExclusionStage2(node, dpid, providerSegmentationId, cidr,
actionForRewriteExclusion);
if (status.isSuccess()) {
// Update cache
- if (actionForRewriteExclusion == AbstractEvent.Action.ADD) {
+ if (actionForRewriteExclusion == Action.ADD) {
ipRewriteExclusionCache.add(cacheKey);
} else {
ipRewriteExclusionCache.remove(cacheKey);
}
private Status programIpRewriteExclusionStage2(Node node, Long dpid, String providerSegmentationId, String cidr,
- AbstractEvent.Action actionForNode) {
- Status status = multiTenantRouterForwardingProvider == null ?
+ Action actionForNode) {
+ Status status = inboundNatProvider == null ?
new Status(StatusCode.SUCCESS) :
- multiTenantRouterForwardingProvider
- .programIpRewriteExclusion(node, dpid, providerSegmentationId, cidr, actionForNode);
+ inboundNatProvider.programIpRewriteExclusion(node, dpid, providerSegmentationId, cidr, actionForNode);
if (status.isSuccess()) {
logger.debug("IpRewriteExclusion {} for cidr:{} node:{} action:{}",
- multiTenantRouterForwardingProvider == null ? "skipped" : "programmed",
+ inboundNatProvider == null ? "skipped" : "programmed",
cidr, node, actionForNode);
} else {
logger.error("IpRewriteExclusion failed for cidr:{} node:{} action:{} status:{}",
private void programDefaultRouteStage1(Node node, Long dpid, String providerSegmentationId,
String defaultGatewayMacAddress, String gatewayIp,
- AbstractEvent.Action actionForNodeDefaultRoute) {
+ Action actionForNodeDefaultRoute) {
// Based on the local cache, figure out whether programming needs to occur. To do this, we
// will look at desired action for node.
//
final String cacheKey = node.toString() + ":" + providerSegmentationId + ":" + gatewayIp;
final Boolean isProgrammed = defaultRouteCache.contains(cacheKey);
- if (actionForNodeDefaultRoute == AbstractEvent.Action.DELETE && isProgrammed == Boolean.FALSE) return;
- if (actionForNodeDefaultRoute == AbstractEvent.Action.ADD && isProgrammed == Boolean.TRUE) return;
+ if (actionForNodeDefaultRoute == Action.DELETE && isProgrammed == Boolean.FALSE) return;
+ if (actionForNodeDefaultRoute == Action.ADD && isProgrammed == Boolean.TRUE) return;
Status status = this.programDefaultRouteStage2(node, dpid, providerSegmentationId,
defaultGatewayMacAddress, gatewayIp, actionForNodeDefaultRoute);
if (status.isSuccess()) {
// Update cache
- if (actionForNodeDefaultRoute == AbstractEvent.Action.ADD) {
+ if (actionForNodeDefaultRoute == Action.ADD) {
defaultRouteCache.add(cacheKey);
} else {
defaultRouteCache.remove(cacheKey);
private Status programDefaultRouteStage2(Node node, Long dpid, String providerSegmentationId,
String defaultGatewayMacAddress,
String gatewayIp,
- AbstractEvent.Action actionForNodeDefaultRoute) {
+ Action actionForNodeDefaultRoute) {
Status status;
try {
InetAddress inetAddress = InetAddress.getByName(gatewayIp);
- status = multiTenantRouterForwardingProvider == null ?
+ status = routingProvider == null ?
new Status(StatusCode.SUCCESS) :
- multiTenantRouterForwardingProvider
- .programDefaultRouteEntry(node, dpid, providerSegmentationId,
- defaultGatewayMacAddress, inetAddress,
- actionForNodeDefaultRoute);
+ routingProvider.programDefaultRouteEntry(node, dpid, providerSegmentationId,
+ defaultGatewayMacAddress, inetAddress,
+ actionForNodeDefaultRoute);
} catch (UnknownHostException e) {
status = new Status(StatusCode.BADREQUEST);
}
if (status.isSuccess()) {
logger.debug("ProgramDefaultRoute {} for mac:{} gatewayIp:{} node:{} action:{}",
- multiTenantRouterForwardingProvider == null ? "skipped" : "programmed",
+ routingProvider == null ? "skipped" : "programmed",
defaultGatewayMacAddress, gatewayIp, node, actionForNodeDefaultRoute);
} else {
logger.error("ProgramDefaultRoute failed for mac:{} gatewayIp:{} node:{} action:{} status:{}",
return; // done: go no further w/out all the info needed...
}
- final AbstractEvent.Action action = isDelete ? AbstractEvent.Action.DELETE : AbstractEvent.Action.ADD;
+ final Action action = isDelete ? Action.DELETE : Action.ADD;
List<Node> nodes = connectionService.getNodes();
for (Node node : nodes) {
final Long dpid = getDpid(node);
- final AbstractEvent.Action actionForNode =
+ final Action actionForNode =
tenantNetworkManager.isTenantNetworkPresentInNode(node, providerSegmentationId) ?
- action : AbstractEvent.Action.DELETE;
+ action : Action.DELETE;
// Rewrite from float to fixed and vice-versa
//
private void programIpRewriteStage1(Node node, Long dpid, String providerSegmentationId,
String matchAddress, String rewriteAddress,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
// Based on the local cache, figure out whether programming needs to occur. To do this, we
// will look at desired action for node.
//
matchAddress + ":" + rewriteAddress;
final Boolean isProgrammed = ipRewriteCache.contains(cacheKey);
- if (actionForNode == AbstractEvent.Action.DELETE && isProgrammed == Boolean.FALSE) return;
- if (actionForNode == AbstractEvent.Action.ADD && isProgrammed == Boolean.TRUE) return;
+ if (actionForNode == Action.DELETE && isProgrammed == Boolean.FALSE) return;
+ if (actionForNode == Action.ADD && isProgrammed == Boolean.TRUE) return;
Status status = this.programIpRewriteStage2(node, dpid, providerSegmentationId,
matchAddress, rewriteAddress, actionForNode);
if (status.isSuccess()) {
// Update cache
- if (actionForNode == AbstractEvent.Action.ADD) {
+ if (actionForNode == Action.ADD) {
ipRewriteCache.add(cacheKey);
} else {
ipRewriteCache.remove(cacheKey);
private Status programIpRewriteStage2(Node node, Long dpid, String providerSegmentationId,
String matchAddress, String rewriteAddress,
- AbstractEvent.Action actionForNode) {
+ Action actionForNode) {
Status status;
try {
InetAddress inetMatchAddress = InetAddress.getByName(matchAddress);
InetAddress inetRewriteAddress = InetAddress.getByName(rewriteAddress);
- status = multiTenantRouterForwardingProvider == null ?
+ status = inboundNatProvider == null ?
new Status(StatusCode.SUCCESS) :
- multiTenantRouterForwardingProvider
- .programIpRewriteRule(node, dpid, providerSegmentationId,
- inetMatchAddress, inetRewriteAddress, actionForNode);
+ inboundNatProvider.programIpRewriteRule(node, dpid, providerSegmentationId,
+ inetMatchAddress, inetRewriteAddress, actionForNode);
} catch (UnknownHostException e) {
status = new Status(StatusCode.BADREQUEST);
}
if (status.isSuccess()) {
logger.debug("ProgramIpRewrite {} for match:{} rewrite:{} node:{} action:{}",
- multiTenantRouterForwardingProvider == null ? "skipped" : "programmed",
+ inboundNatProvider == null ? "skipped" : "programmed",
matchAddress, rewriteAddress, node, actionForNode);
} else {
logger.error("ProgramIpRewrite failed for match:{} rewrite:{} node:{} action:{} status:{}",