<version>1.2.1-SNAPSHOT</version>
<packaging>bundle</packaging>
+ <properties>
+ <sfc.project.version>0.2.0-SNAPSHOT</sfc.project.version>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>yang-ext</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.sfc</groupId>
+ <artifactId>sfc-model</artifactId>
+ <version>${sfc.project.version}</version>
+ </dependency>
</dependencies>
<build>
+++ /dev/null
-module ietf-acl {
- yang-version 1;
-
- namespace "urn:ietf:params:xml:ns:yang:ietf-acl";
-
- prefix acl;
-
- import ietf-yang-types {
- prefix "ietf";
- }
-
- import packet-fields {
- prefix "packet-fields";
- }
-
- organization
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
-
- contact
- "WG Web: http://tools.ietf.org/wg/netmod/
- WG List: netmod@ietf.org
-
- WG Chair: Juergen Schoenwaelder
- j.schoenwaelder@jacobs-university.de
-
- WG Chair: Tom Nadeau
- tnadeau@lucidvision.com
-
- Editor: Dean Bogdanovic
- deanb@juniper.net
-
- Editor: Kiran Agrahara Sreenivasa
- kkoushik@brocade.com
-
- Editor: Lisa Huang
- yihuan@cisco.com
-
- Editor: Dana Blair
- dblair@cisco.com";
-
- description
- "This YANG module defines a component that describing the
- configuration of Access Control Lists (ACLs).";
-
- revision 2014-10-10 {
- description "Creating base model for netmod.";
- reference
- "RFC 6020: YANG - A Data Modeling Language for the
- Network Configuration Protocol (NETCONF)";
- }
-
- identity acl-base {
- description "Base acl type for all ACL type identifiers.";
- }
-
- identity ip-acl {
- base "acl:acl-base";
- description "layer 3 ACL type";
- }
- identity eth-acl {
- base "acl:acl-base";
- description "layer 2 ACL type";
- }
-
- typedef acl-type {
- type identityref {
- base "acl-base";
- }
- description
- "This type is used to refer to an Access Control List
- (ACL) type";
- }
-
- typedef acl-ref {
- type leafref {
- path "/acl:access-lists/acl:access-list/acl:acl-name";
- }
- description "This type is used by data models that
- need to referenced an acl";
- }
-
- container access-lists {
- description
- "Access control lists.";
-
- list access-list {
- key acl-name;
- description "
- An access list (acl) is an ordered list of
- access list entries (ace). Each ace has a
- sequence number to define the order, list
- of match criteria, and a list of actions.
- Since there are several kinds of acls
- implementeded with different attributes for
- each and different for each vendor, this
- model accomodates customizing acls for
- each kind and for each vendor.
- ";
-
- leaf acl-name {
- type string;
- description "The name of access-list.
- A device MAY restrict the length and value of
- this name, possibly space and special
- characters are not allowed.";
- }
-
- leaf acl-type {
- type acl-type;
- description "Type of ACL";
- }
-
- container acl-oper-data {
- config false;
-
- description "Overall ACL operational data";
- leaf match-counter {
- type ietf:counter64;
- description "Total match count for ACL";
- }
-
- leaf-list targets {
- type string;
- description "List of targets where ACL is applied";
- }
- }
-
- container access-list-entries {
- description "The access-list-entries container contains
- a list of access-list-entry(ACE).";
-
- list access-list-entry {
- key rule-name;
- ordered-by user;
-
- description "List of access list entries(ACE)";
- leaf rule-name {
- type string;
- description "Entry name.";
- }
-
- container matches {
- description "Define match criteria";
- choice ace-type {
- description "Type of ace.";
- case ace-ip {
- uses packet-fields:acl-ip-header-fields;
- choice ace-ip-version {
- description "Choice of IP version.";
- case ace-ipv4 {
- uses packet-fields:acl-ipv4-header-fields;
- }
- case ace-ipv6 {
- uses packet-fields:acl-ipv6-header-fields;
- }
- }
- }
- case ace-eth {
- uses packet-fields:acl-eth-header-fields;
- }
- }
- uses packet-fields:metadata;
- }
-
- container actions {
- description "Define action criteria";
- choice packet-handling {
- default deny;
-
- description "Packet handling action.";
- case deny {
- leaf deny {
- type empty;
- description "Deny action.";
- }
- }
- case permit {
- leaf permit {
- type empty;
- description "Permit action.";
- }
- }
- }
- }
-
- container ace-oper-data {
- config false;
-
- description "Per ace operational data";
- leaf match-counter {
- type ietf:counter64;
- description "Number of matches for an ace";
- }
- }
- }
- }
- }
- }
-}
namespace "urn:opendaylight:params:xml:ns:yang:netvirt:sfc:acl";
prefix "acl";
- import ietf-acl { prefix ietf-acl;}
+ import ietf-access-control-list { prefix ietf-acl;}
import yang-ext { prefix ext; }
revision "2015-01-05" {
}
// TODO: Add choice for Neutron and add fields there instead of at the root of matches
- augment "/ietf-acl:access-lists/ietf-acl:access-list/ietf-acl:access-list-entries" +
- "/ietf-acl:access-list-entry/ietf-acl:matches" {
+ //augment "/ietf-acl:access-lists/ietf-acl:access-list/ietf-acl:access-list-entries/ietf-acl:access-list-entry/ietf-acl:matches" {
+ augment "/ietf-acl:access-lists/ietf-acl:acl/ietf-acl:access-list-entries/ietf-acl:ace/ietf-acl:matches" {
description "Neutron network uuid";
leaf network-uuid {
type string;
}
// TODO: Add choice for Neutron and add fields there instead of at the root of matches
- augment "/ietf-acl:access-lists/ietf-acl:access-list/ietf-acl:access-list-entries" +
- "/ietf-acl:access-list-entry/ietf-acl:actions" {
+ augment "/ietf-acl:access-lists/ietf-acl:acl/ietf-acl:access-list-entries/ietf-acl:ace/ietf-acl:actions" {
description "Redirect traffic to SFC identified by SFC Path ID";
leaf redirect-sfc {
type string;
+++ /dev/null
-module packet-fields {
- yang-version 1;
-
- namespace "urn:ietf:params:xml:ns:yang:packet-fields";
-
- prefix packet-fields;
-
- import ietf-inet-types {
- prefix "inet";
- }
-
- import ietf-yang-types {
- prefix "yang";
- }
-
- revision 2014-06-25 {
- description "Initial version of packet fields used by access-lists";
- }
-
- grouping acl-transport-header-fields {
- description "Transport header fields";
-
- container source-port-range {
- description "inclusive range of source ports";
- leaf lower-port {
- mandatory true;
- type inet:port-number;
- }
- leaf upper-port {
- type inet:port-number;
- }
- }
-
- container destination-port-range {
- description "inclusive range of destination ports";
- leaf lower-port {
- mandatory true;
- type inet:port-number;
- }
- leaf upper-port {
- type inet:port-number;
- }
- }
- }
-
- grouping acl-ip-header-fields {
- description "Header fields common to ipv4 and ipv6";
-
- uses acl-transport-header-fields;
-
- leaf dscp {
- type inet:dscp;
- }
-
- leaf ip-protocol {
- type uint8;
- }
-
- }
-
- grouping acl-ipv4-header-fields {
- description "fields in IPv4 header";
-
- leaf destination-ipv4-address {
- type inet:ipv4-prefix;
- }
-
- leaf source-ipv4-address {
- type inet:ipv4-prefix;
- }
-
- }
-
- grouping acl-ipv6-header-fields {
- description "fields in IPv6 header";
-
- leaf destination-ipv6-address {
- type inet:ipv6-prefix;
- }
-
- leaf source-ipv6-address {
- type inet:ipv6-prefix;
- }
-
- leaf flow-label {
- type inet:ipv6-flow-label;
- }
-
- }
-
- grouping acl-eth-header-fields {
- description "fields in ethernet header";
-
- leaf destination-mac-address {
- type yang:mac-address;
- }
-
- leaf destination-mac-address-mask {
- type yang:mac-address;
- }
-
- leaf source-mac-address {
- type yang:mac-address;
- }
-
- leaf source-mac-address-mask {
- type yang:mac-address;
- }
- }
-
- grouping timerange {
- description "Define time range entries to restrict
- the access. The time range is identified by a name
- and then referenced by a function, so that those
- time restrictions are imposed on the function itself.";
-
- container absolute {
- description
- "Absolute time and date that
- the associated function starts
- going into effect.";
-
- leaf start {
- type yang:date-and-time;
- description
- "Start time and date";
- }
- leaf end {
- type yang:date-and-time;
- description "Absolute end time and date";
- }
- leaf active {
- type boolean;
- default "true";
- description
- "Specify the associated function
- active or inactive state when
- starts going into effect";
- }
- } // container absolute
- } //grouping timerange
-
- grouping metadata {
- description "Fields associated with a packet but not in the header";
-
- leaf input-interface {
- description "Packet was received on this interface";
- type string;
- }
- uses timerange;
- }
-}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.openflow13.INetvirtSfcOF13Provider;
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessListKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.AccessListEntries;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntryKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.AclKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.AccessListEntries;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.Ace;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.AceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.Classifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.classifier.sffs.Sff;
/**
* Data tree listener for AccessList.
*/
-public class NetvirtSfcAclListener extends AbstractDataTreeListener<AccessList> {
+public class NetvirtSfcAclListener extends AbstractDataTreeListener<Acl> {
private static final Logger LOG = LoggerFactory.getLogger(NetvirtSfcAclListener.class);
private ListenerRegistration<NetvirtSfcAclListener> listenerRegistration;
private MdsalUtils dbutils;
* @param db MdSal {@link DataBroker}
*/
public NetvirtSfcAclListener(final INetvirtSfcOF13Provider provider, final DataBroker db) {
- super(provider, AccessList.class);
+ super(provider, Acl.class);
Preconditions.checkNotNull(db, "DataBroker can not be null!");
dbutils = new MdsalUtils(db);
}
private void registrationListener(final DataBroker db) {
- final DataTreeIdentifier<AccessList> treeId =
+ final DataTreeIdentifier<Acl> treeId =
new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getIetfAclIid());
try {
- LOG.info("Registering Data Change Listener for Netvirt AccesList configuration.");
+ LOG.info("Registering Data Change Listener for NetvirtSfc AccesList configuration.");
listenerRegistration = db.registerDataTreeChangeListener(treeId, this);
} catch (final Exception e) {
LOG.warn("Netvirt AccesList DataChange listener registration fail!");
}
@Override
- public void remove(final InstanceIdentifier<AccessList> identifier,
- final AccessList removeDataObj) {
+ public void remove(final InstanceIdentifier<Acl> identifier,
+ final Acl removeDataObj) {
Preconditions.checkNotNull(removeDataObj, "Removed object can not be null!");
String aclName = removeDataObj.getAclName();
}
@Override
- public void update(final InstanceIdentifier<AccessList> identifier,
- final AccessList original, final AccessList update) {
+ public void update(final InstanceIdentifier<Acl> identifier,
+ final Acl original, final Acl update) {
}
@Override
- public void add(final InstanceIdentifier<AccessList> identifier,
- final AccessList addDataObj) {
+ public void add(final InstanceIdentifier<Acl> identifier,
+ final Acl addDataObj) {
Preconditions.checkNotNull(addDataObj, "Added object can not be null!");
String aclName = addDataObj.getAclName();
LOG.debug("Adding accesslist = {}", identifier);
return InstanceIdentifier.create(Classifiers.class);
}
- public InstanceIdentifier<AccessList> getIetfAclIid() {
- return InstanceIdentifier.create(AccessLists.class).child(AccessList.class);
+ public InstanceIdentifier<Acl> getIetfAclIid() {
+ return InstanceIdentifier.create(AccessLists.class).child(Acl.class);
}
/**
- * Create an {@link AccessListEntry} {@link InstanceIdentifier}.
+ * Create an {@link Ace} {@link InstanceIdentifier}.
* @param aclName is the name of the ACL
* @param ruleName is the name of the rule
- * @return the {@link AccessListEntry} {@link InstanceIdentifier}
+ * @return the {@link Ace} {@link InstanceIdentifier}
*/
- public InstanceIdentifier<AccessListEntry> getIetfAclEntryIid(String aclName, String ruleName) {
- return InstanceIdentifier.create(AccessLists.class).child(AccessList.class,
- new AccessListKey(aclName)).child(AccessListEntries.class).child(AccessListEntry.class,
- new AccessListEntryKey(ruleName));
+ public InstanceIdentifier<Ace> getIetfAclEntryIid(String aclName, String ruleName) {
+ return InstanceIdentifier.create(AccessLists.class).child(Acl.class,
+ new AclKey(aclName)).child(AccessListEntries.class).child(Ace.class,
+ new AceKey(ruleName));
}
}
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.openflow13.INetvirtSfcOF13Provider;
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessListKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.AclKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.Classifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.classifier.sffs.Sff;
final DataTreeIdentifier<Classifier> treeId =
new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getClassifierIid());
try {
- LOG.info("Registering Data Change Listener for Netvirt Classifier configuration.");
+ LOG.info("Registering Data Change Listener for NetvirtSfc Classifier configuration.");
listenerRegistration = db.registerDataTreeChangeListener(treeId, this);
} catch (final Exception e) {
LOG.warn("Netvirt Classifier DataChange listener registration fail!");
Preconditions.checkNotNull(removeDataObj, "Added object can not be null!");
String aclName = removeDataObj.getAcl();
// Read the ACL information from data store and make sure it exists.
- AccessList acl = dbutils.read(LogicalDatastoreType.CONFIGURATION,getIetfAclIid(aclName));
+ Acl acl = dbutils.read(LogicalDatastoreType.CONFIGURATION, getIetfAclIid(aclName));
if (acl == null) {
LOG.debug("IETF ACL with name ={} is not yet configured. skip this operation", aclName);
return;
Preconditions.checkNotNull(addDataObj, "Added object can not be null!");
String aclName = addDataObj.getAcl();
// Read the ACL information from data store and make sure it exists.
- AccessList acl = dbutils.read(LogicalDatastoreType.CONFIGURATION,getIetfAclIid(aclName));
+ Acl acl = dbutils.read(LogicalDatastoreType.CONFIGURATION,getIetfAclIid(aclName));
if (acl == null) {
LOG.debug("IETF ACL with name ={} is not yet configured. skip this operation", aclName);
return;
return InstanceIdentifier.create(Classifiers.class).child(Classifier.class);
}
- private InstanceIdentifier<AccessList> getIetfAclIid(String aclName) {
- return InstanceIdentifier.create(AccessLists.class).child(AccessList.class, new AccessListKey(aclName));
+ private InstanceIdentifier<Acl> getIetfAclIid(String aclName) {
+ return InstanceIdentifier.create(AccessLists.class).child(Acl.class, new AclKey(aclName));
}
}
package org.opendaylight.ovsdb.openstack.netvirt.sfc.openflow13;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.classifiers.classifier.sffs.Sff;
/**
* @param sff - Service Function Forwarder
* @param acl - Access list includes rules that need to be installed in a SFF.
*/
- public void addClassifierRules(Sff sff, AccessList acl);
+ public void addClassifierRules(Sff sff, Acl acl);
/**
* Method removes the OF rules corresponding to rules within ACL
* @param sff - Service Function Forwarder
* @param acl - Access list includes rules that need to be installed in a SFF.
*/
- public void removeClassifierRules(Sff sff, AccessList acl);
+ public void removeClassifierRules(Sff sff, Acl acl);
}
import org.opendaylight.sfc.provider.api.SfcProviderServiceForwarderAPI;
import org.opendaylight.sfc.sfc_ovs.provider.SfcOvsUtil;
import org.opendaylight.yang.gen.v1.urn.cisco.params.xml.ns.yang.sfc.sff.rev140701.service.function.forwarders.ServiceFunctionForwarder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.Actions;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.Matches;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.actions.packet.handling.Deny;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.actions.packet.handling.Permit;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.matches.ace.type.AceEth;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.matches.ace.type.AceIp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.matches.ace.type.ace.ip.ace.ip.version.AceIpv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.Ace;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.Actions;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.Matches;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.actions.packet.handling.Deny;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.actions.packet.handling.Permit;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.matches.ace.type.AceEth;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
}
@Override
- public void addClassifierRules(Sff sff, AccessList acl) {
+ public void addClassifierRules(Sff sff, Acl acl) {
Preconditions.checkNotNull(sff, "Input service function forwarder cannot be NULL!");
Preconditions.checkNotNull(acl, "Input accesslist cannot be NULL!");
LOG.debug("Processing the Classifier rules on Node={}", datapathId);
if (datapathId != null) {
// Program the OF flow on the corresponding open flow node.
- Iterator<AccessListEntry> itr = acl.getAccessListEntries().getAccessListEntry().iterator();
+ Iterator<Ace> itr = acl.getAccessListEntries().getAce().iterator();
while (itr.hasNext()) {
- AccessListEntry entry = itr.next();
+ Ace entry = itr.next();
programOFRules(entry, datapathId, true);
}
}
}
- private void programOFRules(AccessListEntry entry, String datapathId, boolean write) {
+ private void programOFRules(Ace entry, String datapathId, boolean write) {
NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setId(new NodeId(Constants.OPENFLOW_NODE_PREFIX + datapathId));
nodeBuilder.setKey(new NodeKey(nodeBuilder.getId()));
AceIp aceIp = (AceIp)matches.getAceType();
if (aceIp.getAceIpVersion() instanceof AceIpv4) {
AceIpv4 aceIpv4 = (AceIpv4) aceIp.getAceIpVersion();
- MatchUtils.createSrcL3IPv4Match(matchBuilder, aceIpv4.getSourceIpv4Address());
- MatchUtils.createDstL3IPv4Match(matchBuilder, aceIpv4.getDestinationIpv4Address());
- MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getIpProtocol());
- MatchUtils.addLayer4Match(matchBuilder, aceIp.getIpProtocol().intValue(),
+ MatchUtils.createSrcL3IPv4Match(matchBuilder, aceIpv4.getSourceIpv4Network());
+ MatchUtils.createDstL3IPv4Match(matchBuilder, aceIpv4.getDestinationIpv4Network());
+ MatchUtils.createIpProtocolMatch(matchBuilder, aceIp.getProtocol());
+ MatchUtils.addLayer4Match(matchBuilder, aceIp.getProtocol().intValue(),
aceIp.getSourcePortRange().getLowerPort().getValue().intValue(),
aceIp.getDestinationPortRange().getLowerPort().getValue().intValue());
}
}
@Override
- public void removeClassifierRules(Sff sff, AccessList acl) {
+ public void removeClassifierRules(Sff sff, Acl acl) {
// TODO Auto-generated method stub
}
package org.opendaylight.ovsdb.openstack.netvirt.sfc;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.AclUtils;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.ClassifierUtils;
import org.opendaylight.ovsdb.openstack.netvirt.sfc.utils.SfcUtils;
-import org.opendaylight.ovsdb.southbound.SouthboundConstants;
import org.opendaylight.ovsdb.southbound.SouthboundUtil;
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.AccessLists;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessListBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.AccessListEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.ActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.MatchesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessLists;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessListsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.AclBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.AccessListEntriesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.AceBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.ActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.MatchesBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.Classifiers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.netvirt.sfc.classifier.rev150105.ClassifiersBuilder;
private AccessListsBuilder setAccessLists () {
MatchesBuilder matchesBuilder = aclUtils.createMatches(new MatchesBuilder(), 80);
ActionsBuilder actionsBuilder = aclUtils.createActions(new ActionsBuilder(), Boolean.TRUE);
- AccessListEntryBuilder accessListEntryBuilder = aclUtils.createAccessListEntryBuilder(
- new AccessListEntryBuilder(), "http", matchesBuilder, actionsBuilder);
+ AceBuilder accessListEntryBuilder = aclUtils.createAccessListEntryBuilder(
+ new AceBuilder(), "http", matchesBuilder, actionsBuilder);
AccessListEntriesBuilder accessListEntriesBuilder = aclUtils.createAccessListEntries(
new AccessListEntriesBuilder(), accessListEntryBuilder);
- AccessListBuilder accessListBuilder = aclUtils.createAccessList(new AccessListBuilder(),
+ AclBuilder accessListBuilder = aclUtils.createAccessList(new AclBuilder(),
"http", accessListEntriesBuilder);
AccessListsBuilder accessListsBuilder = aclUtils.createAccessLists(new AccessListsBuilder(),
accessListBuilder);
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.AccessListsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.AccessListBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.AccessListEntriesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntry;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.AccessListEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.ActionsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.MatchesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.actions.packet.handling.PermitBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.acl.rev141010.access.lists.access.list.access.list.entries.access.list.entry.matches.ace.type.AceIpBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.AccessListsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.Acl;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.AclBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.AccessListEntriesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.Ace;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.AceBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.ActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.MatchesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.actions.packet.handling.PermitBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev150317.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.packet.fields.rev140625.acl.transport.header.fields.DestinationPortRangeBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.packet.fields.rev150611.acl.transport.header.fields.DestinationPortRangeBuilder;
public class AclUtils {
public MatchesBuilder createMatches (MatchesBuilder matchesBuilder, int destPort) {
return actionsBuilder;
}
- public AccessListEntryBuilder createAccessListEntryBuilder(AccessListEntryBuilder accessListEntryBuilder,
- String ruleName,
- MatchesBuilder matchesBuilder,
- ActionsBuilder actionsBuilder) {
+ public AceBuilder createAccessListEntryBuilder(AceBuilder accessListEntryBuilder,
+ String ruleName,
+ MatchesBuilder matchesBuilder,
+ ActionsBuilder actionsBuilder) {
accessListEntryBuilder.setRuleName(ruleName);
accessListEntryBuilder.setMatches(matchesBuilder.build());
accessListEntryBuilder.setActions(actionsBuilder.build());
}
public AccessListEntriesBuilder createAccessListEntries(AccessListEntriesBuilder accessListEntriesBuilder,
- AccessListEntryBuilder accessListEntryBuilder) {
- List<AccessListEntry> accessListEntriesList = new ArrayList<>();
+ AceBuilder accessListEntryBuilder) {
+ List<Ace> accessListEntriesList = new ArrayList<>();
accessListEntriesList.add(accessListEntryBuilder.build());
return accessListEntriesBuilder;
}
- public AccessListBuilder createAccessList(AccessListBuilder accessListBuilder,
- String aclName,
- AccessListEntriesBuilder accessListEntriesBuilder) {
+ public AclBuilder createAccessList(AclBuilder accessListBuilder,
+ String aclName,
+ AccessListEntriesBuilder accessListEntriesBuilder) {
accessListBuilder.setAclName(aclName);
accessListBuilder.setAccessListEntries(accessListEntriesBuilder.build());
}
public AccessListsBuilder createAccessLists(AccessListsBuilder accessListsBuilder,
- AccessListBuilder accessListBuilder) {
- List<AccessList> accessListList = new ArrayList<>();
+ AclBuilder accessListBuilder) {
+ List<Acl> accessListList = new ArrayList<>();
accessListList.add(accessListBuilder.build());
- accessListsBuilder.setAccessList(accessListList);
+ accessListsBuilder.setAcl(accessListList);
return accessListsBuilder;
}