service/bundle (flatl2).
* Flatl2 is for demo/test purposes only. In real released editions
(eg., base vs. virtualization) other bundles must provide
equivalent functionality.
* Flatl2 has NB API methods to add affinity induced flow settings,
and clear them. Also possible to enable/disable particular affinity
link flow settings by name.
* Switched to using flow rules manager API (instead of FPS).
* AffinityManager is only a metadata repository.
Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
Conflicts:
l2agent/src/main/java/org/opendaylight/affinity/l2agent/L2Agent.java
Signed-off-by: Suchi Raman <suchi.raman@plexxi.com>
org.opendaylight.controller.sal.packet,
org.opendaylight.controller.sal.inventory,
org.opendaylight.controller.sal.flowprogrammer,
- !org.codehaus.enunciate.jaxrs
+ org.codehaus.enunciate.jaxrs,
+ org.slf4j
</Import-Package>
</instructions>
<manifestLocation>${project.basedir}/META-INF</manifestLocation>
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * Represents the attribute associated with an affinity link.
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public abstract class AffinityAttribute implements Serializable {
+ private static final long serialVersionUID = 1L;
+ private static final Logger logger = LoggerFactory.getLogger(AffinityAttribute.class);
+ @XmlElement
+ protected AffinityAttributeType type;
+ private transient boolean isValid = true;
+
+ /* Dummy constructor for JAXB */
+ public AffinityAttribute() {
+ }
+
+ public AffinityAttributeType getType() {
+ return type;
+ }
+
+ /**
+ * Returns the id of this action
+ *
+ * @return String
+ */
+ public String getId() {
+ return type.getId();
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((type == null) ? 0 : type.calculateConsistentHashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ AffinityAttribute other = (AffinityAttribute) obj;
+ if (type != other.type) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return type.toString();
+ }
+
+}
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+/**
+ * The enumeration of affinity attributes.
+ */
+public enum AffinityAttributeType {
+ SET_DENY("deny"),
+ SET_PATH_REDIRECT("set_path_redirect");
+
+ String id;
+
+ private AffinityAttributeType(String id) {
+ this.id = id;
+ }
+ public String getId() {
+ return id;
+ }
+ public int calculateConsistentHashCode() {
+ if (this.id != null) {
+ return this.id.hashCode();
+ } else {
+ return 0;
+ }
+ }
+
+}
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
+import org.opendaylight.affinity.affinity.AffinityAttribute;
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
AffinityGroup fromGroup;
@XmlElement
AffinityGroup toGroup;
+
+ // Keep at most one affinity attribute per type.
+ private HashMap<AffinityAttributeType, AffinityAttribute> attrlist;
+
+ // xxx
@XmlElement
String affinityAttribute;
@XmlElement
String affinityWaypoint;
public AffinityLink() {
+ attrlist = new HashMap<AffinityAttributeType, AffinityAttribute>();
}
public AffinityLink(String name, AffinityGroup fromGroup, AffinityGroup toGroup) {
this.name = name;
this.fromGroup = fromGroup;
this.toGroup = toGroup;
+ attrlist = new HashMap<AffinityAttributeType, AffinityAttribute>();
}
public String getName() {
return this.name;
public void setToGroup(AffinityGroup toGroup) {
this.toGroup = toGroup;
}
- public void setAttribute(String attribute) {
- this.affinityAttribute = attribute;
+ public void addAttribute(AffinityAttribute attr) {
+ if (attr != null) {
+ System.out.println("Printing affinity attribute: " + attr.type);
+ attrlist.put(attr.type, attr);
+ }
+ }
+ public HashMap<AffinityAttributeType, AffinityAttribute> getAttributeList() {
+ return this.attrlist;
}
/* Set the waypoint address, if the attribute is "redirect" */
+ public void setAttribute(String attribute) {
+ this.affinityAttribute = attribute;
+ }
+
+ // Create a service chain of one waypoint.
public void setWaypoint(String wpaddr) {
- this.affinityWaypoint = wpaddr;
+ SetPathRedirect redirect = new SetPathRedirect();
+ redirect.addWaypoint(NetUtils.parseInetAddress(wpaddr));
+
+ /* Add this service chain to this affinity link. */
+ addAttribute((AffinityAttribute) redirect);
+ }
+
+ public AffinityAttribute getWaypoint() {
+ return attrlist.get(AffinityAttributeType.SET_PATH_REDIRECT);
}
- public String getWaypoint() {
- return this.affinityWaypoint;
+
+ public boolean isDeny() {
+ return attrlist.containsKey(AffinityAttributeType.SET_DENY);
+ }
+
+ // Drop flows matching this affinity link
+ public void setDeny() {
+ SetDeny deny = new SetDeny();
+ addAttribute(deny);
}
public String getAttribute() {
return this.affinityAttribute;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.HashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.Set;
import java.util.Collection;
import org.opendaylight.affinity.affinity.AffinityLink;
/**
- * Primary purpose of this interface is to provide methods for
- * applications to set affinity configuration.
+ * Interface to class for maintaining affinity configuration.
*/
public interface IAffinityManager {
public List<Entry<Host, Host>> getAllFlowsByHost(AffinityLink al);
public List<Entry<AffinityIdentifier, AffinityIdentifier>> getAllFlowsByAffinityIdentifier(AffinityLink al);
+ /**
+ * Returns a map of groupname, derived from affinity link name, to
+ * the list of flow objects corresponding to that link. This
+ * should be a consistent snapshot of all configured objects.
+ */
+ public HashMap<String, List<Flow>>getAllFlowGroups();
- /* Program the nf service chain for this affinity link. */
- /* Methods to add and enable network service chains. */
- public Status addNfchain(AffinityLink al);
- public Status enableRedirect(AffinityLink al) throws Exception;
- public Status disableRedirect(AffinityLink al) throws Exception;
+ // For each flowgroup, there is a list of attributes. This api
+ // call fetches this as a hashmap. Key of the outer hashmap is the
+ // name of the affinity link (aka flowgroup). Key for the inner
+ // hashmap is the affinity attribute type.
+ public HashMap<String, HashMap<AffinityAttributeType,AffinityAttribute>>getAllAttributes();
- // public Status addFlowRulesForRedirect(AffinityLink al) throws Exception;
- // public Status pushFlowRule(InetAddress from, InetAddress to, byte [] mac);
+ public List<Flow> getFlowlist(AffinityLink al);
}
--- /dev/null
+/*
+ * Copyright (c) 2013 Plexxi, Inc. and others. All rights reserved.
+ *
+ * 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
+ */
+
+package org.opendaylight.affinity.affinity;
+
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+import java.util.Set;
+import java.util.Collection;
+import java.util.Map.Entry;
+
+import org.opendaylight.controller.sal.core.Host;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.core.NodeConnector;
+import org.opendaylight.controller.sal.core.Property;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.flowprogrammer.Flow;
+
+import org.opendaylight.affinity.affinity.AffinityLink;
+
+/**
+ * Program flows in a flat layer 2 domain.
+ */
+public interface IFlatL2AffinityManager {
+
+ public Status addNfchain(AffinityLink al);
+ public Status enableRedirect(AffinityLink al) throws Exception;
+ public Status disableRedirect(AffinityLink al) throws Exception;
+
+}
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Represent the action of dropping matched flows.
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class SetDeny extends AffinityAttribute {
+ private static final long serialVersionUID = 1L;
+
+ public SetDeny() {
+ type = AffinityAttributeType.SET_DENY;
+ }
+}
--- /dev/null
+package org.opendaylight.affinity.affinity;
+
+import java.net.InetAddress;
+import java.util.List;
+import java.util.ArrayList;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.NONE)
+public class SetPathRedirect extends AffinityAttribute {
+ private static final long serialVersionUID = 1L;
+ @XmlElement
+ private List<InetAddress> waypointList;
+
+ public SetPathRedirect() {
+ type = AffinityAttributeType.SET_PATH_REDIRECT;
+ waypointList = new ArrayList<InetAddress>();
+ }
+
+ public List<InetAddress> getWaypointList() {
+ return this.waypointList;
+ }
+
+ public void addWaypoint(InetAddress ipaddr) {
+ waypointList.add(ipaddr);
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ for (InetAddress address: waypointList) {
+ result = prime * result + ((address == null) ? 0 : address.hashCode());
+ }
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ SetPathRedirect other = (SetPathRedirect) obj;
+ /* xxx check first element. */
+ InetAddress address = waypointList.get(0);
+ List<InetAddress> otherlist = other.getWaypointList();
+ return waypointList.equals(otherlist);
+ }
+
+ @Override
+ public String toString() {
+ String string = type + "[";
+ for (InetAddress address: waypointList) {
+ string = string + address.toString();
+ }
+ string = string + "]";
+ return string;
+ }
+}
+
+
+
// Now lets add a service dependency to make sure the
// provider of service exists
/* L2agent dependency causes the service to fail activation. tbd. */
- c.add(createContainerServiceDependency(containerName)
- .setService(IfL2Agent.class)
- .setCallbacks("setL2Agent", "unsetL2Agent")
- .setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- NFchainAgent.class).setCallbacks(
- "setNFchainAgent", "unsetNFchainAgent")
- .setRequired(true));
- c.add(createContainerServiceDependency(containerName)
- .setService(IFlowProgrammerService.class)
- .setCallbacks("setFlowProgrammerService", "unsetFlowProgrammerService")
- .setRequired(true));
c.add(createContainerServiceDependency(containerName).setService(
IClusterContainerServices.class).setCallbacks(
"setClusterContainerService",
"unsetClusterContainerService").setRequired(true));
+
+ // hosttracker is used to return the HostNodeConnector corresponding to an affinity ID.
c.add(createContainerServiceDependency(containerName).setService(IfIptoHost.class)
.setCallbacks("setHostTracker", "unsetHostTracker").setRequired(true));
- c.add(createContainerServiceDependency(containerName)
- .setService(ISwitchManager.class)
- .setCallbacks("setSwitchManager", "unsetSwitchManager")
- .setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(
- IAffinityManagerAware.class).setCallbacks(
- "setAffinityManagerAware", "unsetAffinityManagerAware")
- .setRequired(false));
}
}
}
package org.opendaylight.affinity.affinity.internal;
-
-import org.opendaylight.yang.gen.v1.affinity.rev130925.AffinityService;
-import org.opendaylight.yang.gen.v1.affinity.rev130925.HostEndpoint;
-import org.opendaylight.yang.gen.v1.affinity.rev130925.host_endpoint.L2address;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
-
-import org.opendaylight.yang.gen.v1.affinity.rev130925.CreategroupInput;
-import org.opendaylight.yang.gen.v1.affinity.rev130925.AddendpointInput;
-
-import java.util.concurrent.Future;
-import org.opendaylight.controller.sal.common.util.Futures;
-import org.opendaylight.controller.sal.common.util.Rpcs;
-
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.ObjectInputStream;
import org.opendaylight.controller.clustering.services.IClusterContainerServices;
import org.opendaylight.controller.clustering.services.IClusterServices;
import org.opendaylight.controller.configuration.IConfigurationContainerAware;
-//import org.opendaylight.controller.forwardingrulesmanager.FlowEntry;
-//import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
+import org.opendaylight.controller.hosttracker.IfIptoHost;
import org.opendaylight.controller.sal.flowprogrammer.Flow;
import org.opendaylight.controller.sal.utils.IPProtocols;
import org.opendaylight.controller.sal.utils.ObjectWriter;
import org.opendaylight.controller.sal.utils.NetUtils;
-import org.opendaylight.controller.hosttracker.IfIptoHost;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.controller.sal.utils.StatusCode;
import org.opendaylight.affinity.affinity.AffinityGroup;
import org.opendaylight.affinity.affinity.AffinityLink;
import org.opendaylight.affinity.affinity.AffinityIdentifier;
+import org.opendaylight.affinity.affinity.AffinityAttributeType;
+import org.opendaylight.affinity.affinity.AffinityAttribute;
import org.opendaylight.affinity.affinity.IAffinityManager;
import org.opendaylight.affinity.affinity.IAffinityManagerAware;
-
-import org.opendaylight.controller.hosttracker.IfIptoHost;
-import org.opendaylight.controller.hosttracker.IfNewHostNotify;
-import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-import org.opendaylight.affinity.l2agent.IfL2Agent;
-import org.opendaylight.affinity.nfchainagent.NFchainAgent;
-import org.opendaylight.affinity.nfchainagent.NFchainconfig;
import org.opendaylight.affinity.affinity.InetAddressMask;
import org.slf4j.Logger;
/**
* Affinity configuration.
*/
-public class AffinityManagerImpl implements IAffinityManager, AffinityService, IfNewHostNotify,
+public class AffinityManagerImpl implements IAffinityManager,
IConfigurationContainerAware, IObjectReader, ICacheUpdateAware<Long, String> {
private static final Logger log = LoggerFactory.getLogger(AffinityManagerImpl.class);
private static String ROOT = GlobalConstants.STARTUPHOME.toString();
private static final String SAVE = "Save";
+
+ // write all objects to a single file.
private String affinityLinkFileName = null;
private String affinityGroupFileName = null;
- // private IForwardingRulesManager ruleManager;
- private IFlowProgrammerService programmer = null;
- private NFchainAgent nfchainagent = null;
- private ISwitchManager switchManager = null;
- private IfL2Agent l2agent = null;
- private IfIptoHost hostTracker = null;
-
private ConcurrentMap<String, AffinityGroup> affinityGroupList;
private ConcurrentMap<String, AffinityLink> affinityLinkList;
private ConcurrentMap<Long, String> configSaveEvent;
private final Set<IAffinityManagerAware> affinityManagerAware = Collections
.synchronizedSet(new HashSet<IAffinityManagerAware>());
- private byte[] MAC;
private static boolean hostRefresh = true;
private int hostRetryCount = 5;
private IClusterContainerServices clusterContainerService = null;
private String containerName = GlobalConstants.DEFAULT.toString();
private boolean isDefaultContainer = true;
private static final int REPLACE_RETRY = 1;
+ private IfIptoHost hostTracker;
private static short REDIRECT_IPSWITCH_PRIORITY = 3;
}
- void setHostTracker(IfIptoHost h) {
- log.info("Setting hosttracker {}", h);
- this.hostTracker = h;
- }
-
- void unsetHostTracker(IfIptoHost h) {
- if (this.hostTracker.equals(h)) {
- this.hostTracker = null;
- }
- }
- /* public void setForwardingRulesManager(
- IForwardingRulesManager forwardingRulesManager) {
- log.debug("Setting ForwardingRulesManager");
- this.ruleManager = forwardingRulesManager;
- }
-
- public void unsetForwardingRulesManager(
- IForwardingRulesManager forwardingRulesManager) {
- if (this.ruleManager == forwardingRulesManager) {
- this.ruleManager = null;
- }
- }
- */
- public void setFlowProgrammerService(IFlowProgrammerService s)
- {
- this.programmer = s;
- }
-
- public void unsetFlowProgrammerService(IFlowProgrammerService s) {
- if (this.programmer == s) {
- this.programmer = null;
- }
- }
-
- void setNFchainAgent(NFchainAgent s)
- {
- log.info("Setting nfchainagent {}", s);
- this.nfchainagent = s;
- }
-
- void unsetNFchainAgent(NFchainAgent s) {
- if (this.nfchainagent == s) {
- this.nfchainagent = null;
- }
- }
-
- void setL2Agent(IfL2Agent s)
- {
- log.info("Setting l2agent {}", s);
- this.l2agent = s;
- }
-
- void unsetL2Agent(IfL2Agent s) {
- if (this.l2agent == s) {
- this.l2agent = null;
- }
- }
-
- void setSwitchManager(ISwitchManager s)
- {
- this.switchManager = s;
- }
-
- void unsetSwitchManager(ISwitchManager s) {
- if (this.switchManager == s) {
- this.switchManager = null;
- }
- }
-
- /*
- public void setForwardingRulesManager(
- IForwardingRulesManager forwardingRulesManager) {
- this.ruleManager = forwardingRulesManager;
- }
-
- public void unsetForwardingRulesManager(
- IForwardingRulesManager forwardingRulesManager) {
- if (this.ruleManager == forwardingRulesManager) {
- this.ruleManager = null;
- }
- }
- */
-
public Status addAffinityLink(AffinityLink al) {
boolean putNewLink = false;
return new Status(StatusCode.SUCCESS);
}
- /* public byte [] InetAddressToMAC(InetAddress inetAddr) {
- // HostNodeConnector
- log.debug("Find {} -> {} using hostTracker {}", inetAddr, host, hostTracker);
- byte [] dst_mac = host.getDataLayerAddressBytes();
- return dst_mac;
- }
- */
-
public Status removeAffinityLink(String name) {
affinityLinkList.remove(name);
return new Status(StatusCode.SUCCESS);
public ArrayList<AffinityIdentifier> getAllElementsByAffinityIdentifier(AffinityGroup ag) {
return ag.getAllElements();
}
-
@Override
public List<Host> getAllElementsByHost(AffinityGroup ag) {
List<Host> hostList= new ArrayList<Host>();
for (AffinityIdentifier h : ag.getAllElements()) {
- /* TBD: Do not assume this to be an InetAddress. */
h.print();
if (hostTracker != null) {
Host host1 = hostTracker.hostFind((InetAddress) h.get());
}
return hostPairList;
}
-
@Override
public List<Entry<AffinityIdentifier, AffinityIdentifier>> getAllFlowsByAffinityIdentifier(AffinityLink al) {
List<Entry<AffinityIdentifier, AffinityIdentifier>> hostPairList= new ArrayList<Entry<AffinityIdentifier, AffinityIdentifier>>();
return hostPairList;
}
- private void notifyHostUpdate(HostNodeConnector host, boolean added) {
- if (host == null) {
- return;
- }
- log.info("Host update received (new = {}).", added);
- }
-
- @Override
- public void notifyHTClient(HostNodeConnector host) {
- notifyHostUpdate(host, true);
- }
-
- @Override
- public void notifyHTClientHostRemoved(HostNodeConnector host) {
- notifyHostUpdate(host, false);
- }
-
-
@Override
public Status saveConfiguration() {
return saveAffinityConfig();
log.debug("Cluster Service set for affinity mgr");
this.clusterContainerService = s;
}
-
+
void unsetClusterContainerService(IClusterContainerServices s) {
if (this.clusterContainerService == s) {
log.debug("Cluster Service removed for affinity mgr!");
this.clusterContainerService = null;
}
}
-
+
+ void setHostTracker(IfIptoHost h) {
+ log.info("Setting hosttracker {}", h);
+ this.hostTracker = h;
+ }
+
+ void unsetHostTracker(IfIptoHost h) {
+ if (this.hostTracker.equals(h)) {
+ this.hostTracker = null;
+ }
+ }
+
/* Add a nfchain config for this affinity link. */
- List<Flow> getFlowlist(AffinityLink al) {
+ public List<Flow> getFlowlist(AffinityLink al) {
InetAddress from = null, to = null;
log.info("get flowlist affinity link = {}", al.getName());
}
return flowlist;
}
-
- /* From affinity link, create a nfc config. Pass this nfc config to nfchainagent. */
- public Status addNfchain(AffinityLink al) {
- List<Flow> flowlist = getFlowlist(al);
- InetAddress waypoint = NetUtils.parseInetAddress(al.getWaypoint());
- NFchainconfig nfcc = new NFchainconfig(al.getName(), flowlist, waypoint);
- String key = al.getName();
- nfchainagent.addNfchain(key, nfcc);
- log.info("Added nfchain {}", al.getName());
- return new Status(StatusCode.SUCCESS);
+
+ public HashMap<String, List<Flow>>getAllFlowGroups() {
+ HashMap<String, List<Flow>> flowgroups = new HashMap<String, List<Flow>>();
+ for (AffinityLink al: getAllAffinityLinks()) {
+ List<Flow> flowlist = getFlowlist(al);
+ flowgroups.put(al.getName(), flowlist);
+ }
+ return flowgroups;
}
- public Status enableRedirect(AffinityLink al) throws Exception {
- String nfccname = al.getName();
- return nfchainagent.enable(nfccname);
- }
-
- public Status disableRedirect(AffinityLink al) throws Exception {
- String nfccname = al.getName();
- return nfchainagent.disable(nfccname);
- }
+ public HashMap<String, HashMap<AffinityAttributeType,AffinityAttribute>>getAllAttributes() {
+ HashMap<String, HashMap<AffinityAttributeType, AffinityAttribute>>attributes =
+ new HashMap<String, HashMap<AffinityAttributeType, AffinityAttribute>>();
- public Status removeNfchain(AffinityLink al) throws Exception {
- String nfccname = al.getName();
- return nfchainagent.removeNfchain(nfccname);
+
+ for (AffinityLink al: getAllAffinityLinks()) {
+ HashMap<AffinityAttributeType, AffinityAttribute> pergroupattrs = al.getAttributeList();
+ attributes.put(al.getName(), pergroupattrs);
+ }
+ return attributes;
}
-
-
- /* public methods for the yang service. */
- public Future<RpcResult<Void>> creategroup(CreategroupInput input) {
- AffinityGroup ag1 = new AffinityGroup(input.getName());
-
- /* Correctly translate between status fields. */
- Status ret = addAffinityGroup(ag1);
- RpcResult<Void> result = Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
- return Futures.immediateFuture(result);
- }
- public Future<RpcResult<Void>> addendpoint(AddendpointInput input) {
- AffinityGroup ag = getAffinityGroup(input.getGroupname());
- RpcResult<Void> result;
-
- if (ag != null) {
- HostEndpoint endpoint = input.getEndpoint();
- L2address l2address = endpoint.getL2address();
- Ipv4Prefix l3address = endpoint.getL3address();
-
- /* ag.addL2address(); */
- ag.addInetMask(l3address.toString());
- result = Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
- } else {
- result = Rpcs.<Void> getRpcResult(false, null, Collections.<RpcError> emptySet());
- }
- return Futures.immediateFuture(result);
- }
}
/* Test the get methods. */
/* Get all members as hosts */
- System.out.println("Affinity group (as Hosts) = " + ag1.getName());
- List<Host> hostlist = affinitymgr.getAllElementsByHost(ag1);
+ // System.out.println("Affinity group (as Hosts) = " + ag1.getName());
+ // List<Host> hostlist = affinitymgr.getAllElementsByHost(ag1);
- for (Host h : hostlist) {
- System.out.println("host = " + h.getNetworkAddressAsString());
- }
+ // for (Host h : hostlist) {
+ // System.out.println("host = " + h.getNetworkAddressAsString());
+ //}
/* Get all members as affinity identifiers */
System.out.println("Affinity group (as Affinity Identifiers) = " + ag1.getName());
Status ret = affinityManager.addAffinityLink(al1);
if (!ret.isSuccess()) {
- throw new InternalServerErrorException(ret.getDescription());
+ // throw new InternalServerErrorException(ret.getDescription());
+ log.error("Create affinity link {}", ret);
}
return Response.status(Response.Status.CREATED).build();
}
log.info("Set waypoint address (link)" + affinityLinkName + " (waypoint ip) " + waypointIP);
AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
- al1.setWaypoint(waypointIP);
- try {
- affinityManager.addNfchain(al1);
- } catch (Exception e) {
- String message = "An error occurred during flow programming.";
- log.error(message, e);
- }
+ al1.setWaypoint(waypointIP);
return Response.status(Response.Status.CREATED).build();
}
- @Path("/{containerName}/link/{affinityLinkName}/enable")
- @PUT
- @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- @TypeHint(Response.class)
- @StatusCodes({
- @ResponseCode(code = 200, condition = "Operation successful"),
- @ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
- @ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
- public Response enableLink(
- @PathParam("containerName") String containerName,
- @PathParam("affinityLinkName") String affinityLinkName) {
-
- if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
- throw new UnauthorizedException("User is not authorized to perform this operation on container "
- + containerName);
- }
-
- IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
- if (affinityManager == null) {
- throw new ServiceUnavailableException("Affinity Manager "
- + RestMessages.SERVICEUNAVAILABLE.toString());
- }
- log.info("Enable (link) " + affinityLinkName);
-
- AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
- try {
- affinityManager.enableRedirect(al1);
- } catch (Exception e) {
- String message = "An error occurred during flow programming.";
- log.error(message, e);
- }
- return Response.status(Response.Status.CREATED).build();
- }
+ /**
+ * Mark this affinity link with "deny".
+ *
+ * @param containerName
+ * Name of the Container
+ * @param affinityLinkName
+ * Name of the new affinity link being marked.
+ * @return Response as dictated by the HTTP Response Status code
+ */
- @Path("/{containerName}/link/{affinityLinkName}/disable")
+ @Path("/{containerName}/link/{affinityLinkName}/deny/")
@PUT
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@TypeHint(Response.class)
@ResponseCode(code = 200, condition = "Operation successful"),
@ResponseCode(code = 404, condition = "The Container Name or nodeId or configuration name is not found"),
@ResponseCode(code = 503, condition = "One or more of Controller services are unavailable") })
- public Response disableLink(
+ public Response setLinkDeny(
@PathParam("containerName") String containerName,
@PathParam("affinityLinkName") String affinityLinkName) {
-
+
if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.WRITE, this)) {
throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ containerName);
throw new ServiceUnavailableException("Affinity Manager "
+ RestMessages.SERVICEUNAVAILABLE.toString());
}
- log.info("Disable (link) " + affinityLinkName);
+ log.info("Set deny (link)" + affinityLinkName);
AffinityLink al1 = affinityManager.getAffinityLink(affinityLinkName);
- try {
- affinityManager.disableRedirect(al1);
- } catch (Exception e) {
- String message = "An error occurred during flow programming.";
- log.error(message, e);
- }
+ al1.setDeny();
return Response.status(Response.Status.CREATED).build();
}
return new AffinityGroupList(affinityManager.getAllAffinityGroups());
}
+
+
+ @Path("/{containerName}/affinity-links")
+ @GET
+ @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
+ @TypeHint(AffinityLinkList.class)
+ @StatusCodes({ @ResponseCode(code = 200, condition = "Operation successful"),
+ @ResponseCode(code = 401, condition = "User not authorized to perform this operation"),
+ @ResponseCode(code = 404, condition = "The containerName is not found"),
+ @ResponseCode(code = 503, condition = "One or more of Controller Services are unavailable") })
+ public AffinityLinkList getAllAffinityLinks(@PathParam("containerName") String containerName) {
+
+ // if (!isValidContainer(containerName)) {
+ // throw new ResourceNotFoundException("Container " + containerName + " does not exist.");
+ //}
+
+ if (!NorthboundUtils.isAuthorized(getUserName(), containerName, Privilege.READ, this)) {
+ throw new UnauthorizedException("User is not authorized to perform this operation on container "
+ + containerName);
+ }
+
+ IAffinityManager affinityManager = getIfAffinityManagerService(containerName);
+ if (affinityManager == null) {
+ throw new ServiceUnavailableException("Affinity Manager "
+ + RestMessages.SERVICEUNAVAILABLE.toString());
+ }
+ log.info("list all links");
+ return new AffinityLinkList(affinityManager.getAllAffinityLinks());
+ }
+
/**
@Path("/{containerName}/")
@GET
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinityParent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
-
- <artifactId>l2agent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.3.6</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.sal.packet,
- org.opendaylight.controller.sal.match,
- org.opendaylight.controller.sal.action,
- org.opendaylight.controller.sal.flowprogrammer,
- org.opendaylight.controller.switchmanager,
- org.apache.felix.dm,
- org.osgi.service.component,
- org.slf4j
- </Import-Package>
- <Export-Package>
- org.opendaylight.affinity.l2agent
- </Export-Package>
- <Bundle-Activator>
- org.opendaylight.affinity.l2agent.Activator
- </Bundle-Activator>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>switchmanager</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * 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
- */
-
-package org.opendaylight.affinity.l2agent;
-
-import java.util.Hashtable;
-import java.util.Dictionary;
-import org.apache.felix.dm.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.controller.sal.packet.IListenDataPacket;
-import org.opendaylight.controller.sal.packet.IDataPacketService;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-
-public class Activator extends ComponentActivatorAbstractBase {
- protected static final Logger logger = LoggerFactory
- .getLogger(Activator.class);
-
- /**
- * Function called when the activator starts just after some
- * initializations are done by the
- * ComponentActivatorAbstractBase.
- *
- */
- public void init() {
-
- }
-
- /**
- * Function called when the activator stops just before the
- * cleanup done by ComponentActivatorAbstractBase
- *
- */
- public void destroy() {
-
- }
-
- /**
- * Function that is used to communicate to dependency manager the
- * list of known implementations for services inside a container
- *
- *
- * @return An array containing all the CLASS objects that will be
- * instantiated in order to get an fully working implementation
- * Object
- */
- public Object[] getImplementations() {
- Object[] res = { L2Agent.class };
- return res;
- }
-
- /**
- * Function that is called when configuration of the dependencies
- * is required.
- *
- * @param c dependency manager Component object, used for
- * configuring the dependencies exported and imported
- * @param imp Implementation class that is being configured,
- * needed as long as the same routine can configure multiple
- * implementations
- * @param containerName The containerName being configured, this allow
- * also optional per-container different behavior if needed, usually
- * should not be the case though.
- */
- public void configureInstance(Component c, Object imp, String containerName) {
- if (imp.equals(L2Agent.class)) {
- // export the services
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "L2Agent");
- c.setInterface(new String[] { IListenDataPacket.class.getName(),
- IfL2Agent.class.getName() }, props);
-
- // register dependent modules
- c.add(createContainerServiceDependency(containerName).setService(
- ISwitchManager.class).setCallbacks("setSwitchManager",
- "unsetSwitchManager").setRequired(true));
-
- c.add(createContainerServiceDependency(containerName).setService(
- IDataPacketService.class).setCallbacks(
- "setDataPacketService", "unsetDataPacketService")
- .setRequired(true));
-
- c.add(createContainerServiceDependency(containerName).setService(
- IFlowProgrammerService.class).setCallbacks(
- "setFlowProgrammerService", "unsetFlowProgrammerService")
- .setRequired(true));
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * 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
- */
-
-/*
- * Copyright (c) 2013 Plexxi, Inc. and others. All rights reserved.
- */
-
-
-package org.opendaylight.affinity.l2agent;
-
-import java.net.InetAddress;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.core.Node;
-
-public interface IfL2Agent {
-
- public NodeConnector lookup_output_port(Node node, byte [] dstMAC);
-
-}
+++ /dev/null
-\r
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-\r
-package org.opendaylight.affinity.l2agent;\r
-\r
-\r
-import junit.framework.TestCase;\r
-\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-\r
-public class L2AgentTest extends TestCase {\r
-\r
- @Test\r
- public void testL2AgentCreation() {\r
-\r
- L2Agent ah = null;\r
- ah = new L2Agent();\r
- Assert.assertTrue(ah != null);\r
-\r
- }\r
-\r
-}\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinityParent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
-
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>nfchain.api</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/affinity.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/affinity.git</developerConnection>
- </scm>
-
- <properties>
- <yang.version>0.5.9-SNAPSHOT</yang.version>
- <yang.codegen.version>0.5.8-SNAPSHOT</yang.codegen.version>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <maven.compiler.source>1.7</maven.compiler.source>
- <maven.compiler.target>1.7</maven.compiler.target>
- <maven.bundle.version>2.4.0</maven.bundle.version>
- <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
- </properties>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.3.6</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-maven-plugin</artifactId>
- <version>${yang.version}</version>
- <executions>
- <execution>
- <goals>
- <goal>generate-sources</goal>
- </goals>
- <configuration>
- <yangFilesRootDir>src/main/yang</yangFilesRootDir>
- <codeGenerators>
- <generator>
- <codeGeneratorClass>
- org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl
- </codeGeneratorClass>
- <outputBaseDir>
- target/generated-sources/sal
- </outputBaseDir>
- </generator>
- </codeGenerators>
- <inspectDependencies>true</inspectDependencies>
- </configuration>
- </execution>
- </executions>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>maven-sal-api-gen-plugin</artifactId>
- <version>${yang.codegen.version}</version>
- <type>jar</type>
- </dependency>
- </dependencies>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>target/generated-sources/sal</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- <pluginManagement>
- <plugins>
- <!--This plugin's configuration is used to store Eclipse
- m2e settings only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.opendaylight.yangtools
- </groupId>
- <artifactId>
- yang-maven-plugin
- </artifactId>
- <versionRange>
- [0.5,)
- </versionRange>
- <goals>
- <goal>
- generate-sources
- </goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore></ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
-
-
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-inventory</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-binding</artifactId>
- <version>${yang.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-common</artifactId>
- <version>${yang.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-inet-types</artifactId>
- <version>2010.09.24-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>ietf-yang-types</artifactId>
- <version>2010.09.24-SNAPSHOT</version>
- </dependency>
-<!-- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-ext</artifactId>
- <version>2013.09.07.1-SNAPSHOT</version>
- </dependency> -->
- <dependency>
- <groupId>org.opendaylight.yangtools.model</groupId>
- <artifactId>opendaylight-l2-types</artifactId>
- <version>2013.08.27.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller.model</groupId>
- <artifactId>model-flow-base</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-
-</project>
+++ /dev/null
-module nfchain {
- namespace "urn:opendaylight:affinity:nfchain";
- prefix nfchain;
-
- import ietf-inet-types { prefix inet; }
- import ietf-yang-types { prefix yang; }
- import yang-ext { prefix ext; }
- import opendaylight-inventory {prefix inv;}
- import opendaylight-l2-types { prefix l2types; }
- import opendaylight-flow-types { prefix flow-types; }
-
- revision "2013-10-20" {
- description "Initial revision of affinity model to be reviewed";
- }
-
- //**************************************************
- // Gateway hosting the network function.
- //**************************************************
- grouping gateway {
- leaf id {
- type string;
- }
- // xxx address is an IP prefix.
- leaf location {
- description "Inet address";
- type inet:ipv4-prefix;
- }
- }
-
- // Each nf chain has an id, a flowspec and a list of gateways.
- grouping chain {
- leaf name {
- type string;
- }
-
- list flow {
- uses flow-types:flow;
- }
-
- list gateway {
- key id;
- ext:context-instance "gateway-context";
- uses gateway;
- }
- }
-
- // Container for all nf_chain objects
- container nfdb {
- list chain {
- key id;
- ext:context-instance "chain-context";
- uses chain;
- }
- }
-
- identity gateway-context;
-
- typedef gateway-ref {
- type instance-identifier;
- }
-
- // nf chain reference.
- typedef chain-ref {
- type instance-identifier;
- }
- identity chain-context;
-
- //**************************************************
- // Add a chain to the service.
- //**************************************************
- rpc addchain {
- input {
- container chain {
- uses chain;
- }
- }
- }
-
- rpc enablechain {
- input {
- leaf chain {
- type chain-ref;
- }
- }
- }
-
-}
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
-
- <parent>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinityParent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <relativePath>../..</relativePath>
- </parent>
-
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>nfchain-impl</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
- </scm>
-
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>2.3.6</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-Activator>org.opendaylight.affinity.nfchain.provider.Activator</Bundle-Activator>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>nfchain.api</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>nfchainagent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-compability</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>hosttracker</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-binding-api</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * 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
- */
-
-/*
- * Copyright (c) 2013 Plexxi, Inc. and others. All rights reserved.
- */
-
-package org.opendaylight.affinity.nfchain.provider;
-
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-import java.util.Collection;
-import java.util.Collections;
-
-import org.opendaylight.controller.sal.binding.api.AbstractBindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
-import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
-import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
-
-import org.opendaylight.yangtools.yang.binding.RpcService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.controller.hosttracker.IfIptoHost;
-import org.opendaylight.controller.hosttracker.IfNewHostNotify;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.NfchainService;
-
-public class Activator extends AbstractBindingAwareProvider {
- protected static final Logger log = LoggerFactory
- .getLogger(Activator.class);
-
- private ProviderContext providerContext;
- private NfchainManager nfcmgr;
-
- public Activator() {
- nfcmgr = new NfchainManager();
- }
-
- @Override
- public void onSessionInitiated(ProviderContext session) {
- log.info("Provider session initialized");
-
- this.providerContext = session;
- nfcmgr.setNotificationProvider(session.getSALService(NotificationProviderService.class));
- providerContext.addRpcImplementation(NfchainService.class, nfcmgr);
- }
-
- @Override
- public Collection<? extends RpcService> getImplementations() {
- return Collections.emptySet();
- }
-
- @Override
- public Collection<? extends ProviderFunctionality> getFunctionality() {
- return Collections.emptySet();
- }
-}
+++ /dev/null
-
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * 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
- */
-
-package org.opendaylight.affinity.nfchain.provider;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.ArrayList;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
-import org.opendaylight.controller.sal.common.util.Futures;
-import org.opendaylight.controller.sal.common.util.Rpcs;
-
-import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.NfchainService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.NfchainData;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.NfdbBuilder;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.chain.Gateway;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.Nfdb;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.NfdbBuilder;
-
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.AddchainInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.EnablechainInput;
-
-import org.opendaylight.affinity.nfchainagent.NFchainconfig;
-
-import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.packet.BitBufferHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.controller.hosttracker.IfIptoHost;
-import org.opendaylight.controller.hosttracker.IfNewHostNotify;
-
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.addchain.input.Chain;
-import java.net.InetAddress;
-import org.opendaylight.controller.sal.compability.ToSalConversionsUtils;
-
-import org.opendaylight.yang.gen.v1.urn.opendaylight.affinity.nfchain.rev131020.chain.Flow;
-
-/**
- * NfchainManager -- sends flow programming rules to flow programming service.
- */
-public class NfchainManager implements NfchainService, NfchainData {
- private static final long serialVersionUID = 1L;
- protected static final Logger log = LoggerFactory.getLogger(NfchainManager.class);
-
- private NotificationProviderService notificationProvider;
- private Future<RpcResult<Void>> currentTask;
-
- public NfchainManager() {
- }
-
- @Override
- public Nfdb getNfdb() {
- NfdbBuilder builder = new NfdbBuilder();
- return builder.build();
- }
-
- /**
- * Convert API Flow objects to flow programmer flow objects.
- */
- List<org.opendaylight.controller.sal.flowprogrammer.Flow> fromAPIFlowlist(List<Flow> fl) {
- List<org.opendaylight.controller.sal.flowprogrammer.Flow> flowlist = new ArrayList<org.opendaylight.controller.sal.flowprogrammer.Flow>();
-
- for (Flow f: fl) {
- org.opendaylight.controller.sal.flowprogrammer.Flow fp_flow = ToSalConversionsUtils.toFlow(f);
- flowlist.add(fp_flow);
- }
- return flowlist;
- }
-
- /**
- * addchain synchronous.
- */
- @Override
- public Future<RpcResult<Void>> addchain(AddchainInput input) {
- // TODO Auto-generated method stub
- Chain chain = input.getChain();
-
- List<org.opendaylight.controller.sal.flowprogrammer.Flow> flowlist = fromAPIFlowlist(chain.getFlow());
- List<Gateway> gatewaylist = chain.getGateway();
- String name = chain.getName();
-
- if (gatewaylist.size() > 1) {
- log.info("addNfchain function chain has {} elements", gatewaylist.size());
- } else {
-
- log.info("add gateway - Received input chain = {}, gateway = {}.", input.getChain(), chain.getGateway());
- Gateway gw = gatewaylist.get(0);
- InetAddress ip = ToSalConversionsUtils.inetAddressFrom(gw.getLocation());
- NFchainconfig nfcc = new NFchainconfig(name, flowlist, ip);
- /* nfchainagent.addNfchain(); */
- }
- RpcResult<Void> result = Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
- return Futures.immediateFuture(result);
- }
-
- @Override
- public Future<RpcResult<java.lang.Void>> enablechain(EnablechainInput input) {
- log.info("enable chain");
-
- RpcResult<Void> result = Rpcs.<Void> getRpcResult(true, null, Collections.<RpcError> emptySet());
- return Futures.immediateFuture(result);
- }
-
- public void setNotificationProvider(NotificationProviderService salService) {
- this.notificationProvider = salService;
- }
-}
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinityParent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </parent>
-
- <packaging>pom</packaging>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>nfchain</artifactId>
- <version>0.4.1-SNAPSHOT</version>
-
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/affinity.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/affinity.git</developerConnection>
- </scm>
-
- <modules>
- <module>api</module>
- <module>impl</module>
- </modules>
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinityParent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <relativePath>..</relativePath>
- </parent>
- <scm>
- <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
- <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
- </scm>
-
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>nfchainagent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>${bundle.plugin.version}</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Import-Package>
- org.opendaylight.controller.sal.utils,
- org.opendaylight.controller.sal.core,
- org.opendaylight.controller.forwardingrulesmanager,
- org.opendaylight.controller.hosttracker,
- org.opendaylight.controller.hosttracker.hostAware,
- org.opendaylight.controller.switchmanager,
- org.opendaylight.controller.clustering.services,
- org.opendaylight.controller.sal.action,
- org.opendaylight.controller.sal.flowprogrammer,
- org.opendaylight.controller.sal.match,
- org.opendaylight.controller.sal.packet,
- org.opendaylight.controller.sal.routing,
- org.opendaylight.controller.topologymanager,
- org.apache.commons.lang3.builder,
- org.opendaylight.affinity.l2agent,
- org.junit;resolution:=optional,
- org.slf4j,
- org.apache.felix.dm,
- javax.xml.bind.annotation
- </Import-Package>
- <Export-Package>
- org.opendaylight.affinity.nfchainagent
- </Export-Package>
- <Bundle-Activator>
- org.opendaylight.affinity.nfchainagent.Activator
- </Bundle-Activator>
- </instructions>
- <manifestLocation>${project.basedir}/META-INF</manifestLocation>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>hosttracker</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>l2agent</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.affinity</groupId>
- <artifactId>affinity</artifactId>
- <version>0.4.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
+++ /dev/null
-
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * 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
- */
-
-/* Network function chaining service. */
-package org.opendaylight.affinity.nfchainagent;
-
-import java.util.Hashtable;
-import java.util.Dictionary;
-import org.apache.felix.dm.Component;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;
-import org.opendaylight.controller.sal.packet.IListenDataPacket;
-import org.opendaylight.controller.sal.packet.IDataPacketService;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-
-import org.opendaylight.controller.hosttracker.IfIptoHost;
-import org.opendaylight.affinity.l2agent.IfL2Agent;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
-//import org.opendaylight.controller.forwardingrulesmanager.IForwardingRulesManager;
-
-public class Activator extends ComponentActivatorAbstractBase {
- protected static final Logger logger = LoggerFactory
- .getLogger(Activator.class);
-
- /**
- * Function called when the activator starts just after some
- * initializations are done by the
- * ComponentActivatorAbstractBase.
- *
- */
- public void init() {
-
- }
-
- /**
- * Function called when the activator stops just before the
- * cleanup done by ComponentActivatorAbstractBase
- *
- */
- public void destroy() {
-
- }
-
- /**
- * Function that is used to communicate to dependency manager the
- * list of known implementations for services inside a container
- *
- *
- * @return An array containing all the CLASS objects that will be
- * instantiated in order to get an fully working implementation
- * Object
- */
- public Object[] getImplementations() {
- Object[] res = { NFchainAgent.class };
- return res;
- }
-
- /**
- * Function that is called when configuration of the dependencies
- * is required.
- *
- * @param c dependency manager Component object, used for
- * configuring the dependencies exported and imported
- * @param imp Implementation class that is being configured,
- * needed as long as the same routine can configure multiple
- * implementations
- * @param containerName The containerName being configured, this allow
- * also optional per-container different behavior if needed, usually
- * should not be the case though.
- */
- public void configureInstance(Component c, Object imp, String containerName) {
- if (imp.equals(NFchainAgent.class)) {
- // export the services
- Dictionary<String, String> props = new Hashtable<String, String>();
- props.put("salListenerName", "NFchainAgent");
- c.setInterface(new String[] { NFchainAgent.class.getName() }, props);
-
- // register dependent modules
- c.add(createContainerServiceDependency(containerName)
- .setService(IfL2Agent.class)
- .setCallbacks("setL2Agent", "unsetL2Agent")
- .setRequired(true));
- c.add(createContainerServiceDependency(containerName).setService(IfIptoHost.class)
- .setCallbacks("setHostTracker", "unsetHostTracker").setRequired(true));
-
- c.add(createContainerServiceDependency(containerName).setService(
- ISwitchManager.class).setCallbacks("setSwitchManager",
- "unsetSwitchManager").setRequired(true));
-
- c.add(createContainerServiceDependency(containerName).setService(
- IFlowProgrammerService.class).setCallbacks(
- "setFlowProgrammerService", "unsetFlowProgrammerService")
- .setRequired(true));
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Plexxi, Inc. All rights reserved.
- *
- * 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
- */
-
-
-package org.opendaylight.affinity.nfchainagent;
-
-import java.lang.Short;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.opendaylight.controller.sal.utils.NetUtils;
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.utils.StatusCode;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.affinity.affinity.IAffinityManager;
-import org.opendaylight.controller.hosttracker.IfIptoHost;
-import org.opendaylight.controller.hosttracker.hostAware.HostNodeConnector;
-import org.opendaylight.controller.sal.core.Host;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.core.NodeConnector;
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
-import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
-import org.opendaylight.controller.sal.action.Action;
-import org.opendaylight.controller.sal.action.Output;
-import org.opendaylight.controller.sal.match.Match;
-import org.opendaylight.controller.sal.match.MatchField;
-import org.opendaylight.controller.sal.match.MatchType;
-import org.opendaylight.controller.sal.packet.address.EthernetAddress;
-
-import org.opendaylight.affinity.l2agent.IfL2Agent;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
-
-import java.io.Serializable;
-
-public class NFchainAgent implements Serializable {
-
- private static final Logger log = LoggerFactory.getLogger(NFchainAgent.class);
- private IFlowProgrammerService programmer = null;
- private IfL2Agent l2agent = null;
- private IfIptoHost hostTracker = null;
- private ISwitchManager switchManager = null;
-
- private HashMap<String, NFchainconfig> allconfigs;
-
- void init() {
- log.debug("INIT called!");
- }
-
- void destroy() {
- log.debug("DESTROY called!");
- }
-
- void start() {
- log.debug("START called!");
- }
-
- void started(){
- }
-
- void stop() {
- log.debug("STOP called!");
- }
-
- void setHostTracker(IfIptoHost h) {
- log.info("Setting hosttracker {}", h);
- this.hostTracker = h;
- }
-
- void unsetHostTracker(IfIptoHost h) {
- if (this.hostTracker.equals(h)) {
- this.hostTracker = null;
- }
- }
- public void setFlowProgrammerService(IFlowProgrammerService s)
- {
- this.programmer = s;
- }
-
- public void unsetFlowProgrammerService(IFlowProgrammerService s) {
- if (this.programmer == s) {
- this.programmer = null;
- }
- }
- void setL2Agent(IfL2Agent s)
- {
- log.info("Setting l2agent {}", s);
- this.l2agent = s;
- }
-
- void unsetL2Agent(IfL2Agent s) {
- if (this.l2agent == s) {
- this.l2agent = null;
- }
- }
-
- void setSwitchManager(ISwitchManager s)
- {
- this.switchManager = s;
- }
-
- void unsetSwitchManager(ISwitchManager s) {
- if (this.switchManager == s) {
- this.switchManager = null;
- }
- }
-
- public Status addNfchain(String key, NFchainconfig nfcc) {
- String name;
-
- if (allconfigs == null) {
- allconfigs = new HashMap<String, NFchainconfig>();
- }
- /* xxx compute changelist and push flow changes. */
- if (allconfigs.containsKey(key)) {
- return new Status(StatusCode.CONFLICT,
- "NFchain with the specified name already configured.");
- }
- NFchainconfig oldcfg = allconfigs.get(key);
- if (oldcfg == null) {
- if (allconfigs.put(key, nfcc) == null) {
- return new Status(StatusCode.SUCCESS);
- }
- }
- return new Status(StatusCode.CONFLICT,
- "Unknown error during addNFchain.");
- }
-
- /**
- * add flow rules for set of flows in nfchainconfig. Do this for
- * each node connector in the network proactively.
- */
- public Status addrules(Node node, NFchainconfig nfcc) throws Exception {
- List<Flow> flowlist = nfcc.getFlowList();
- for (Flow f: flowlist) {
- HostNodeConnector wphost = (HostNodeConnector) hostTracker.hostFind(nfcc.getWaypointIP());
- List<Action> actions = new ArrayList<Action>();
- /* Look up the output port leading to the waypoint. */
- NodeConnector dst_connector = l2agent.lookup_output_port(node, wphost.getDataLayerAddressBytes());
-
- log.debug("Waypoint direction added: node {} and connector {}", node, dst_connector);
- if (dst_connector != null) {
- f.setActions(actions);
- f.addAction(new Output(dst_connector));
- log.debug("flow push add flow = {} to node = {} ", f, node);
- Status status = programmer.addFlow(node, f);
- if (!status.isSuccess()) {
- log.debug("Error during addFlow: {} on {}. The failure is: {}",
- f, node, status.getDescription());
- }
- }
- }
- return new Status(StatusCode.SUCCESS);
- }
-
-
-
- /**
- * remove flow rules for set of flows in nfchainconfig. Do this for
- * each node connector in the network proactively.
- */
- public Status removerules(Node node, NFchainconfig nfcc) throws Exception {
- List<Flow> flowlist = nfcc.getFlowList();
- for (Flow f: flowlist) {
- HostNodeConnector wphost = (HostNodeConnector) hostTracker.hostFind(nfcc.getWaypointIP());
- List<Action> actions = new ArrayList<Action>();
- /* Look up the output port leading to the waypoint. */
- NodeConnector dst_connector = l2agent.lookup_output_port(node, wphost.getDataLayerAddressBytes());
-
- log.debug("Waypoint settings removed: node {} and connector {}", node, dst_connector);
- if (dst_connector != null) {
- f.setActions(actions);
- f.addAction(new Output(dst_connector));
- log.debug("flow push remove flow = {} to node = {} ", f, node);
- Status status = programmer.removeFlow(node, f);
- if (!status.isSuccess()) {
- log.debug("Error during removeFlow: {} on {}. The failure is: {}",
- f, node, status.getDescription());
- }
- }
- }
- return new Status(StatusCode.SUCCESS);
- }
-
-
- public Status removeNfchain(String key) {
- if (allconfigs != null) {
- allconfigs.remove(key);
- }
- return new Status(StatusCode.SUCCESS);
- }
-
- /**
- * Enable the nfchain by programming flow rules on its behalf.
- */
- public Status enable(String cfgname) throws Exception {
- /* Get all node connectors. */
- Set<Node> nodes = switchManager.getNodes();
- NFchainconfig cfg = allconfigs.get(cfgname);
-
- Status success = new Status(StatusCode.SUCCESS);
- Status notfound = new Status(StatusCode.NOTFOUND);
- Status ret;
-
- if (nodes == null) {
- log.debug("No nodes in network.");
- return success;
- }
-
- /* Send this flow rule to all nodes in the network. */
- for (Node node: nodes) {
- ret = addrules(node, cfg);
- }
- return new Status(StatusCode.SUCCESS);
- }
-
- /**
- * Remove openflow rules added earlier. Restore default routing via standard L2 learning methods.
- */
- public Status disable(String cfgname) throws Exception {
- /* Get all node connectors. */
- Set<Node> nodes = switchManager.getNodes();
- NFchainconfig cfg = allconfigs.get(cfgname);
-
- Status success = new Status(StatusCode.SUCCESS);
- Status notfound = new Status(StatusCode.NOTFOUND);
- Status ret;
-
- if (nodes == null) {
- log.debug("No nodes in network.");
- return success;
- }
-
- /* Send this flow rule to all nodes in the network. */
- for (Node node: nodes) {
- ret = removerules(node, cfg);
- }
- return new Status(StatusCode.SUCCESS);
- }
-}
-
+++ /dev/null
-package org.opendaylight.affinity.nfchainagent;
-
-import org.opendaylight.controller.sal.utils.NetUtils;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.List;
-import java.util.ArrayList;
-
-import org.opendaylight.controller.sal.utils.Status;
-import org.opendaylight.controller.sal.utils.StatusCode;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.SecurityContext;
-
-import org.codehaus.enunciate.jaxrs.ResponseCode;
-import org.codehaus.enunciate.jaxrs.StatusCodes;
-import org.codehaus.enunciate.jaxrs.TypeHint;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-
-import org.opendaylight.controller.sal.flowprogrammer.Flow;
-
-/**
- * Configuration object representing a network function chain.
- * flowlist is the set of flows to be redirected.
- * dstIP is the singleton waypoint, representing the waypoint server.
- */
-
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.NONE)
-public class NFchainconfig implements Cloneable, Serializable {
- private static final long serialVersionUID = 1L;
-
- @XmlAttribute
- private String name;
- @XmlElement
- private final List<Flow> flowlist;
- private InetAddress dstIP;
-
- public NFchainconfig(String name) {
- this.name = name;
- flowlist = new ArrayList<Flow>();
- dstIP = null;
- }
-
- // Set the flowlist and destination IP of the network function.
- public NFchainconfig(String name, List<Flow> flowlist, InetAddress dstIP) {
- this.name = name;
- this.flowlist = flowlist;
- this.dstIP = dstIP;
- }
-
- // add a flow to the flowlist.
- public Status addFlow(Flow f) {
- flowlist.add(f);
- return new Status(StatusCode.SUCCESS);
- }
-
- public List<Flow> getFlowList() {
- return this.flowlist;
- }
- public InetAddress getWaypointIP() {
- return this.dstIP;
- }
- public void print() {
- System.out.println("Printing NFchain config " + this.name);
- for (Flow value : flowlist) {
- System.out.println("flow is " + value);
- }
- }
- public String getName() {
- return name;
- }
-}
-
-
<testvm.argLine>-Xmx1024m -XX:MaxPermSize=256m</testvm.argLine>
<url.version>1.5.0</url.version>
<virgo.version>3.6.0.RELEASE</virgo.version>
+ <hosttracker.version>0.5.1-SNAPSHOT</hosttracker.version>
</properties>
<modules>
<module>affinity/api</module>
- <module>affinity/yang</module>
<module>affinity/implementation</module>
<module>affinity/integrationtest</module>
<module>affinity/northbound</module>
<module>analytics/implementation</module>
<module>analytics/integrationtest</module>
<module>analytics/northbound</module>
- <module>l2agent</module>
- <module>nfchainagent</module>
+ <module>flatl2</module>
+ <module>flatl2/northbound</module>
</modules>
<repositories>