From 340f468bc41ae413bd6f1ca905fa9c2b2a41b3f1 Mon Sep 17 00:00:00 2001 From: Reinaldo Penno Date: Tue, 5 Aug 2014 09:52:16 -0700 Subject: [PATCH] Decoupling of SFF and SF. More bug fixes - Decoupling SFF and SF in a upcoming commit. Today when you create a SF, we create a SFF if it does not exist. But any coupling between the models is really bad because it makes us have to do garbage collection and synching of data. So, the user will have to explicitly create a SFF and in its configuration also specify the list of SFs attached to it. - Changed sfc_provider_config.json to pretty format. - Changed SFC chain model to allow symmetric paths - Fixed a few Yang modules with lines larger than 70 chars. - Fixed a few Yang descriptions according to new arch draft-01 - Fixed LOG statement in SnDataListener() - Fixed service-function-forwarders.json to use new model syntax. - Fixed OVS yang namespace issue Change-Id: I56227cd8ef1d8a78386c75f3c3b6fcd97f34c1cc Signed-off-by: Reinaldo Penno --- .../service-function-forwarders.json | 164 ++++++++---------- .../startup/sfc_provider_config.json | 34 ++-- .../src/main/yang/service-function-chain.yang | 37 ++-- .../yang/service-function-forwarder-ovs.yang | 5 +- .../main/yang/service-function-forwarder.yang | 17 +- .../src/main/yang/service-function-path.yang | 27 +-- .../src/main/yang/service-function-type.yang | 4 +- sfc-model/src/main/yang/service-function.yang | 3 +- sfc-provider/pom.xml | 5 + .../sfc/provider/OpendaylightSfc.java | 18 +- .../SfcProviderSfEntryDataListener.java | 16 +- .../SfcProviderSfpEntryDataListener.java | 2 +- .../provider/SfcProviderSnDataListener.java | 4 +- .../SfcProviderBootstrapRestAPI.java | 3 +- 14 files changed, 173 insertions(+), 166 deletions(-) diff --git a/sfc-distribution/src/main/resources/configuration/startup/bootstrap/service-function-forwarders.json b/sfc-distribution/src/main/resources/configuration/startup/bootstrap/service-function-forwarders.json index d04f10e59..ecf2b17d1 100755 --- a/sfc-distribution/src/main/resources/configuration/startup/bootstrap/service-function-forwarders.json +++ b/sfc-distribution/src/main/resources/configuration/startup/bootstrap/service-function-forwarders.json @@ -1,97 +1,75 @@ { - "service-function-forwarders": { - "service-function-forwarder": [ - { - "name": "SFF-bootstrap", - "sff-data-plane-locator": { - "port": 33333, - "ip": "10.3.1.101" - }, - "transport": "service-function-forwarder:vxlan-gpe", - "service-function-dictionary": [ - { - "name": "dpi-102-3", - "type": "dpi", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10003, - "ip": "10.3.1.102" - } - }, - { - "name": "napt44-104", - "type": "napt44", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10020, - "ip": "10.3.1.104" - } - }, - { - "name": "firewall-101-1", - "type": "firewall", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10001, - "ip": "10.3.1.101" - } - }, - { - "name": "napt44-103-2", - "type": "napt44", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10002, - "ip": "10.3.1.103" - } - }, - { - "name": "napt44-103-1", - "type": "napt44", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10001, - "ip": "10.3.1.103" - } - }, - { - "name": "firewall-101-2", - "type": "firewall", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10002, - "ip": "10.3.1.101" - } - }, - { - "name": "firewall-104", - "type": "firewall", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10001, - "ip": "10.3.1.104" - } - }, - { - "name": "dpi-102-1", - "type": "dpi", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10001, - "ip": "10.3.1.102" - } - }, - { - "name": "dpi-102-2", - "type": "dpi", - "service-function-forwarder": "SFF-bootstrap", - "sf-data-plane-locator": { - "port": 10002, - "ip": "10.3.1.102" - } - } - ] + "service-function-forwarders": { + "service-function-forwarder": [ + { + "name": "br-int-ovs-1", + "uuid": "4c3778e4-840d-47f4-b45e-0988e514d26c", + "service-node": "OVSDB1", + "sff-data-plane-locator": [ + { + "name": "eth0", + "data-plane-locator": { + "port": 5000, + "ip": "192.168.1.1" + }, + "transport": "vxlan-gpe" + } + ], + "service-function-dictionary": [ + { + "sf-data-plane-locator": { + "port": 5000, + "ip": "10.1.1.1" + }, + "name": "SF1", + "service-function-forwarder": "br-int-ovs-1", + "type": "dp1" + }, + { + "sf-data-plane-locator": { + "port": 5000, + "ip": "10.1.1.2" + }, + "name": "SF2", + "service-function-forwarder": "br-int-ovs-1", + "type": "firewall" + } + ] + }, + { + "name": "br-int-ovs-2", + "uuid": "fd4d849f-5140-48cd-bc60-6ad1f5fc0a02", + "service-node": "OVSDB2", + "sff-data-plane-locator": [ + { + "name": "eth0", + "data-plane-locator": { + "port": 5000, + "ip": "192.168.1.2" } + } + ], + "service-function-dictionary": [ + { + "sf-data-plane-locator": { + "port": 5000, + "ip": "10.1.1.5" + }, + "name": "SF5", + "service-function-forwarder": "br-int-ovs-2", + "type": "qos" + }, + { + "sf-data-plane-locator": { + "port": 5000, + "ip": "10.1.1.6" + }, + "name": "SF6", + "service-function-forwarder": "br-int-ovs-2", + "type": "napt44" + } ] - } + } + ] + } } \ No newline at end of file diff --git a/sfc-distribution/src/main/resources/configuration/startup/sfc_provider_config.json b/sfc-distribution/src/main/resources/configuration/startup/sfc_provider_config.json index 7ae80ce95..c350d431b 100755 --- a/sfc-distribution/src/main/resources/configuration/startup/sfc_provider_config.json +++ b/sfc-distribution/src/main/resources/configuration/startup/sfc_provider_config.json @@ -1,13 +1,25 @@ { - "bootstrap": { - "bootstrapDataDir": "configuration/startup/bootstrap/", - "configDataUrl": "http://localhost:8080/restconf/config/", - "configDataMimeType": "application/json", - "files": [ - {"name": "service-function-forwarders.json", "urlpath": "service-function-forwarder:service-function-forwarders"}, - {"name": "service-functions.json", "urlpath": "service-function:service-functions"}, - {"name": "service-function-chains.json", "urlpath": "service-function-chain:service-function-chains"}, - {"name": "service-nodes.json", "urlpath": "service-node:service-nodes"} - ] - } + "bootstrap": { + "bootstrapDataDir": "configuration/startup/bootstrap/", + "configDataUrl": "http://localhost:8080/restconf/config/", + "configDataMimeType": "application/json", + "files": [ + { + "name": "service-function-forwarders.json", + "urlpath": "service-function-forwarder:service-function-forwarders" + }, + { + "name": "service-functions.json", + "urlpath": "service-function:service-functions" + }, + { + "name": "service-function-chains.json", + "urlpath": "service-function-chain:service-function-chains" + }, + { + "name": "service-nodes.json", + "urlpath": "service-node:service-nodes" + } + ] + } } diff --git a/sfc-model/src/main/yang/service-function-chain.yang b/sfc-model/src/main/yang/service-function-chain.yang index 8e68120cd..a9e7db3ea 100644 --- a/sfc-model/src/main/yang/service-function-chain.yang +++ b/sfc-model/src/main/yang/service-function-chain.yang @@ -44,34 +44,36 @@ module service-function-chain { grouping service-function-chain-grouping { list service-function-chain { description - "A service Function chain defines an - abstract set of service functions and their ordering - constraints that must be applied to packets and/or frames - selected as a result of classification. The implied order - may not be a linear progression as the architecture allows - for nodes that copy to more than one branch, and also allows - for cases where there is flexibility in the order in which - services need to be applied. The term service chain is often - used as shorthand for service function chain."; + "A list that holds all service function chains in the + domain"; key "name"; leaf name { type string; description "the name of the service function chain"; } + leaf symmetric { + type boolean; + description + "If the chain is symmetric we will create two service + paths, one ingress and another egress. Packets traverse + the egress service path in the reverse order of the + ingress path"; + } list sfc-service-function { key "name"; leaf name { type string; description - "The name of the service function if known, - otherwise a generic unique string"; + "A unique handle that describes the service function + that will be chosen for this type, such as + ingress-dpi. This is not the service function name"; } leaf type { type string; mandatory true; description - "Service Function Type from service-function-type.yang."; + "Service Function Type from service-function-type.yang"; } ordered-by user; description @@ -89,8 +91,15 @@ module service-function-chain { container service-function-chains { uses service-function-chain-grouping; description - "This containers holds service function chains configuration - data"; + "A service Function chain defines an + abstract set of service functions and their ordering + constraints that must be applied to packets and/or frames + selected as a result of classification. The implied order + may not be a linear progression as the architecture allows + for nodes that copy to more than one branch, and also allows + for cases where there is flexibility in the order in which + services need to be applied. The term service chain is often + used as shorthand for service function chain."; } container service-function-chains-state { diff --git a/sfc-model/src/main/yang/service-function-forwarder-ovs.yang b/sfc-model/src/main/yang/service-function-forwarder-ovs.yang index c2ec7f30e..6a9635c36 100644 --- a/sfc-model/src/main/yang/service-function-forwarder-ovs.yang +++ b/sfc-model/src/main/yang/service-function-forwarder-ovs.yang @@ -1,7 +1,7 @@ module service-function-forwarder-ovs { yang-version 1; - namespace "urn:cisco:params:xml:ns:yang:sfc-acl"; + namespace "urn:cisco:params:xml:ns:yang:sfc-sff-ovs"; prefix sfc-sff-ovs; @@ -16,7 +16,8 @@ module service-function-forwarder-ovs { description "Augmentation of SFF for OVS"; } - augment "/sfc-sff:service-function-forwarders/sfc-sff:service-function-forwarder/" { + augment "/sfc-sff:service-function-forwarders/" + + "sfc-sff:service-function-forwarder/" { description "OVSDB bridge UUID"; leaf uuid { type string; diff --git a/sfc-model/src/main/yang/service-function-forwarder.yang b/sfc-model/src/main/yang/service-function-forwarder.yang index f5977a6e8..69c85604a 100644 --- a/sfc-model/src/main/yang/service-function-forwarder.yang +++ b/sfc-model/src/main/yang/service-function-forwarder.yang @@ -99,7 +99,15 @@ module service-function-forwarder { container service-function-forwarders { + description + "A service function forwarder is + responsible for delivering traffic received from the SFC + network forwarder to one or more connected service + functions via information carried in the SFC encapsulation. + "; list service-function-forwarder { + description + "A list that holds configuration of all SFFs in the domain"; key "name"; leaf name { type string; @@ -163,16 +171,7 @@ module service-function-forwarder { description "A list of all Service Functions attached to this SFF."; } - description - "A service function forwarder is - responsible for delivering traffic received from the SFC - network forwarder to one or more connected service - functions via information carried in the SFC encapsulation. - "; } - description - "This container holds the configuration for all service - function forwarders"; } } diff --git a/sfc-model/src/main/yang/service-function-path.yang b/sfc-model/src/main/yang/service-function-path.yang index 86d32e064..cd963d7e1 100644 --- a/sfc-model/src/main/yang/service-function-path.yang +++ b/sfc-model/src/main/yang/service-function-path.yang @@ -53,7 +53,20 @@ module service-function-path { // Service Function Path container service-function-paths { + description + "The SFP provides a level of indirection + between the fully abstract notion of service chain as an + abstract sequence of functions to be delivered, and the + fully specified notion of exactly what SFF/SFs the packet + will visit when it actually traverses the network. By + allowing the control components to specify the use of this + level of indirection, the deployment may choose the degree + of SFF/SF selection authority that is delegated to the + network"; list service-function-path { + description + "A list that holds configuration data for all SFPs in the + domain"; key "name"; leaf name { type string; @@ -74,7 +87,7 @@ module service-function-path { } ordered-by user; description - "A list of service function instances that compose the + "A list of service functions that compose the service path"; } leaf service-chain-name { @@ -107,18 +120,6 @@ module service-function-path { value for reporting and troubleshooting packets along a specific path."; } - description - "The SFP provides a level of indirection - between the fully abstract notion of service chain as an - abstract sequence of functions to be delivered, and the - fully specified notion of exactly what SFF/SFs the packet - will visit when it actually traverses the network. By - allowing the control components to specify the use of this - level of indirection, the deployment may choose the degree - of SFF/SF selection authority that is delegated to the - network"; } - description - "This container holds all service-paths in the domain"; } } diff --git a/sfc-model/src/main/yang/service-function-type.yang b/sfc-model/src/main/yang/service-function-type.yang index a59a76dea..63e43fd9a 100644 --- a/sfc-model/src/main/yang/service-function-type.yang +++ b/sfc-model/src/main/yang/service-function-type.yang @@ -100,8 +100,8 @@ module service-function-type { "The list of all service functions of a specific type"; } description - "A list of all service types. Each service-type entry holds a - list of all service functions of the type"; + "A list of all service types. Each service-type entry holds + a list of all service functions of the type"; } } } diff --git a/sfc-model/src/main/yang/service-function.yang b/sfc-model/src/main/yang/service-function.yang index 9bceeebed..5bba8463f 100644 --- a/sfc-model/src/main/yang/service-function.yang +++ b/sfc-model/src/main/yang/service-function.yang @@ -47,7 +47,8 @@ module service-function { typedef service-function-ref { type leafref { - path "/sfc-sf:service-functions/sfc-sf:service-function/sfc-sf:name"; + path "/sfc-sf:service-functions/sfc-sf:service-function/" + + "sfc-sf:name"; } description "This type is used by data models that need to reference diff --git a/sfc-provider/pom.xml b/sfc-provider/pom.xml index a37326e20..d32737ba2 100755 --- a/sfc-provider/pom.xml +++ b/sfc-provider/pom.xml @@ -173,6 +173,11 @@ jackson-module-jaxb-annotations ${jackson.version} + + org.glassfish + javax.json + 1.0.4 + diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/OpendaylightSfc.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/OpendaylightSfc.java index 60affa798..c9e9d8687 100755 --- a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/OpendaylightSfc.java +++ b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/OpendaylightSfc.java @@ -117,15 +117,15 @@ public class OpendaylightSfc implements AutoCloseable { if (dataProvider != null) { final AsyncReadWriteTransaction t = dataProvider.newReadWriteTransaction(); - t.delete(LogicalDatastoreType.OPERATIONAL, sfEntryIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sfEntryIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sfEntryIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sfcEntryIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sfsIID); - t.delete(LogicalDatastoreType.OPERATIONAL, snIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sffIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sfpIID); - t.delete(LogicalDatastoreType.OPERATIONAL, sftIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfEntryIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfEntryIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfEntryIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfcEntryIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfsIID); + t.delete(LogicalDatastoreType.CONFIGURATION, snIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sffIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sfpIID); + t.delete(LogicalDatastoreType.CONFIGURATION, sftIID); t.commit().get(); } } diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListener.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListener.java index 1462c0280..486efb2f3 100644 --- a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListener.java +++ b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfEntryDataListener.java @@ -63,10 +63,10 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener { odlSfc.executor.execute(SfcProviderServiceTypeAPI .getDeleteServiceFunctionFromServiceType(serviceTypeObj, serviceTypeClass)); - Object[] sfParams = {originalServiceFunction}; - Class[] sfParamsTypes = {ServiceFunction.class}; - odlSfc.executor.execute(SfcProviderServiceForwarderAPI - .getDeleteServiceFunctionFromForwarder(sfParams, sfParamsTypes )); + //Object[] sfParams = {originalServiceFunction}; + //Class[] sfParamsTypes = {ServiceFunction.class}; + //odlSfc.executor.execute(SfcProviderServiceForwarderAPI + // .getDeleteServiceFunctionFromForwarder(sfParams, sfParamsTypes )); Object[] functionParams = {originalServiceFunction}; Class[] functionParamsTypes = {ServiceFunction.class}; @@ -90,8 +90,8 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener { odlSfc.executor.execute(SfcProviderServiceTypeAPI .getCreateServiceFunctionToServiceType(serviceTypeObj, serviceTypeClass)); - Object[] sfParams = {createdServiceFunction}; - Class[] sfParamsTypes = {ServiceFunction.class}; + //Object[] sfParams = {createdServiceFunction}; + //Class[] sfParamsTypes = {ServiceFunction.class}; //odlSfc.executor.execute(SfcProviderServiceForwarderAPI // .getCreateServiceForwarderAPI(sfParams, sfParamsTypes)); LOG.debug("\n########## getCreatedConfigurationData {} {}", @@ -113,8 +113,8 @@ public class SfcProviderSfEntryDataListener implements DataChangeListener { Object[] sfParams = {updatedServiceFunction}; Class[] sfParamsTypes = {ServiceFunction.class}; - odlSfc.executor.execute(SfcProviderServiceForwarderAPI - .getUpdateServiceForwarderAPI(sfParams, sfParamsTypes )); + //odlSfc.executor.execute(SfcProviderServiceForwarderAPI + // .getUpdateServiceForwarderAPI(sfParams, sfParamsTypes )); odlSfc.executor.execute(SfcProviderServicePathAPI .getUpdateServicePathContainingFunction(sfParams, sfParamsTypes)); diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfpEntryDataListener.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfpEntryDataListener.java index 0515db2e8..d4f5ec400 100644 --- a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfpEntryDataListener.java +++ b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSfpEntryDataListener.java @@ -51,7 +51,7 @@ public class SfcProviderSfpEntryDataListener implements DataChangeListener { } } - // SFC CREATION + // SFP CREATION Map, DataObject> dataCreatedObject = change.getCreatedData(); for (Map.Entry, DataObject> entry : dataCreatedObject.entrySet()) diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSnDataListener.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSnDataListener.java index dc5ce9894..a43f7fb44 100644 --- a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSnDataListener.java +++ b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/SfcProviderSnDataListener.java @@ -32,9 +32,9 @@ public class SfcProviderSnDataListener implements DataChangeListener { public void onDataChanged( final AsyncDataChangeEvent, DataObject> change ) { - LOG.info("\n########## Start: {}", Thread.currentThread().getStackTrace()[1]); + LOG.debug("\n########## Start: {}", Thread.currentThread().getStackTrace()[1]); - LOG.info("\n########## Stop: {}", Thread.currentThread().getStackTrace()[1]); + LOG.debug("\n########## Stop: {}", Thread.currentThread().getStackTrace()[1]); } } diff --git a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/bootstrap/SfcProviderBootstrapRestAPI.java b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/bootstrap/SfcProviderBootstrapRestAPI.java index 169b10a4a..2382cc083 100755 --- a/sfc-provider/src/main/java/org/opendaylight/sfc/provider/bootstrap/SfcProviderBootstrapRestAPI.java +++ b/sfc-provider/src/main/java/org/opendaylight/sfc/provider/bootstrap/SfcProviderBootstrapRestAPI.java @@ -58,7 +58,7 @@ public class SfcProviderBootstrapRestAPI extends SfcProviderAbstractRestAPI { JSONObject jo = providerConfig.getJsonBootstrapObject(); - JSONArray files = new JSONArray(); + JSONArray files; try { final String CONFIG_FILES_DIR = jo.getString("bootstrapDataDir"); @@ -66,6 +66,7 @@ public class SfcProviderBootstrapRestAPI extends SfcProviderAbstractRestAPI { final String CONFIG_DATA_MIME_TYPE = jo.getString("configDataMimeType"); files = jo.getJSONArray("files"); + ClientConfig clientConfig = new DefaultClientConfig(); Client client = Client.create(clientConfig); -- 2.36.6