package org.opendaylight.controller.forwardingrulesmanager;
-import java.io.Serializable;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-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 org.opendaylight.controller.configuration.ConfigurationObject;
import org.opendaylight.controller.sal.action.Action;
import org.opendaylight.controller.sal.action.ActionType;
import org.opendaylight.controller.sal.action.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+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 java.net.Inet6Address;
+import java.net.InetAddress;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
/**
* Configuration Java Object which represents a flow configuration information
* for Forwarding Rules Manager.
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.NONE)
-public class FlowConfig implements Serializable {
+public class FlowConfig extends ConfigurationObject implements Serializable {
private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(FlowConfig.class);
- private static final String NAMEREGEX = "^[a-zA-Z0-9]+$";
public static final String STATICFLOWGROUP = "__StaticFlows__";
public static final String INTERNALSTATICFLOWGROUP = "__InternalStaticFlows__";
public static final String INTERNALSTATICFLOWBEGIN = "__";
Switch sw = null;
try {
- if (name == null || name.trim().isEmpty() || !name.matches(FlowConfig.NAMEREGEX)) {
+ // Flow name cannot be internal flow signature
+ if (!isValidResourceName(name) || isInternalFlow()) {
return new Status(StatusCode.BADREQUEST, "Invalid name");
}
}
Flow flow = new Flow(match, getActionList());
+
if (this.cookie != null) {
flow.setId(Long.parseLong(cookie));
}
if (this.priority != null) {
flow.setPriority(Integer.decode(this.priority).shortValue());
}
+
+
return flow;
}