[VOL-3836] Extract the OLT pipeliners from ONOS

Change-Id: I0dc99aabcb17b46fc5dc8bbe8e3bbd5ece52058a
diff --git a/impl/src/main/resources/any_vlan_cfg.json b/impl/src/main/resources/any_vlan_cfg.json
new file mode 100644
index 0000000..0c42301
--- /dev/null
+++ b/impl/src/main/resources/any_vlan_cfg.json
@@ -0,0 +1,62 @@
+{
+"apps" : {
+  "org.opencord.sadis" : {
+      "sadis" : {
+        "integration" : {
+          "cache" : {
+            "enabled" : true,
+            "maxsize" : 40,
+            "ttl" : "PT1m"
+          }
+        },
+        "entries" : [ {
+          "id" : "s1-eth1",
+          "cTag" : 4096,
+          "sTag" : 4,
+          "nasPortId" : "s1-eth1",
+          "technologyProfileId" : 10,
+          "upstreamBandwidthProfile" : "High-Speed-Internet",
+          "downstreamBandwidthProfile" : "User1-Specific"
+        }, {
+          "id" : "1",
+          "hardwareIdentifier" : "00:00:00:00:00:01",
+          "ipAddress" : "127.0.0.1",
+          "uplinkPort": "2"
+        } ]
+      },
+         "bandwidthprofile":{
+            "integration":{
+               "cache":{
+                  "enabled":true,
+                  "maxsize":40,
+                  "ttl":"PT1m"
+               }
+            },
+            "entries":[
+               {
+                  "id":"High-Speed-Internet",
+                  "cir":200000000,
+                  "cbs":348000,
+                  "eir":10000000,
+                  "ebs":348000,
+                  "air":10000000
+               },
+               {
+                  "id":"User1-Specific",
+                  "cir":300000000,
+                  "cbs":348000,
+                  "eir":20000000,
+                  "ebs":348000
+               }
+            ]
+         }
+    }
+  },
+   "devices":{
+      "of:0000000000000001":{
+         "basic":{
+            "driver":"pmc-olt"
+         }
+      }
+   }
+}
diff --git a/impl/src/main/resources/cfg.json b/impl/src/main/resources/cfg.json
new file mode 100644
index 0000000..0b61e65
--- /dev/null
+++ b/impl/src/main/resources/cfg.json
@@ -0,0 +1,33 @@
+{  
+"apps" : {
+  "org.opencord.sadis" : {
+      "sadis" : {
+        "integration" : {
+          "cache" : {
+            "enabled" : true,
+            "maxsize" : 50,
+            "ttl" : "PT1m"
+          }
+        },
+        "entries" : [ {
+          "id" : "s1-eth1",
+          "cTag" : 2,
+          "sTag" : 4,
+          "nasPortId" : "s1-eth1"
+        }, {
+          "id" : "1",
+          "hardwareIdentifier" : "00:00:00:00:00:01",
+          "ipAddress" : "127.0.0.1",
+          "uplinkPort": "2"
+        } ]
+      }
+    }
+  },
+   "devices":{  
+      "of:0000000000000001":{
+         "basic":{
+            "driver":"pmc-olt"
+         }
+      }
+   }
+}
diff --git a/impl/src/main/resources/custom-topo.py b/impl/src/main/resources/custom-topo.py
new file mode 100644
index 0000000..dfb414d
--- /dev/null
+++ b/impl/src/main/resources/custom-topo.py
@@ -0,0 +1,69 @@
+'''
+ Copyright 2016-present Open Networking Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+'''
+from mininet.cli import CLI
+from mininet.log import setLogLevel
+from mininet.net import Mininet
+from mininet.topo import Topo
+from mininet.node import RemoteController, UserSwitch
+
+class MinimalTopo( Topo ):
+    "Minimal topology with a single switch and two hosts"
+
+    def build( self ):
+        # Create two hosts.
+        h1 = self.addHost( 'h1' )
+        h2 = self.addHost( 'h2' )
+
+        # Create a switch
+        s1 = self.addSwitch( 's1', cls=UserSwitch)
+
+        # Add links between the switch and each host
+        self.addLink( s1, h1 )
+        self.addLink( s1, h2 )
+
+def runMinimalTopo():
+    "Bootstrap a Mininet network using the Minimal Topology"
+
+    # Create an instance of our topology
+    topo = MinimalTopo()
+
+    # Create a network based on the topology using OVS and controlled by
+    # a remote controller.
+    net = Mininet(
+        topo=topo,
+        controller=lambda name: RemoteController( name, ip='127.0.0.1' ),
+        switch=UserSwitch,
+        autoSetMacs=True )
+
+    # Actually start the network
+    net.start()
+
+    # Drop the user in to a CLI so user can run commands.
+    CLI( net )
+
+    # After the user exits the CLI, shutdown the network.
+    net.stop()
+
+if __name__ == '__main__':
+    # This runs if this file is executed directly
+    setLogLevel( 'info' )
+    runMinimalTopo()
+
+# Allows the file to be imported using `mn --custom <filename> --topo minimal`
+topos = {
+    'minimal': MinimalTopo
+}
diff --git a/impl/src/main/resources/olt-drivers.xml b/impl/src/main/resources/olt-drivers.xml
new file mode 100644
index 0000000..fa7b585
--- /dev/null
+++ b/impl/src/main/resources/olt-drivers.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2016-present Open Networking Foundation
+  ~
+  ~ Licensed under the Apache License, Version 2.0 (the "License");
+  ~ you may not use this file except in compliance with the License.
+  ~ You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+<drivers>
+    <driver name="celestica" extends="default"
+            manufacturer="PMC GPON Networks" hwVersion="PAS5211 v2" swVersion="vOLT version 1.5.3.*">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.OltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+    </driver>
+    <driver name="pmc-olt" extends="default"
+            manufacturer="PMC GPON Networks" hwVersion="PASffffffff v-1" swVersion="vOLT.*">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.OltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+    </driver>
+    <driver name="voltha" extends="default"
+            manufacturer="VOLTHA Project" hwVersion=".*" swVersion=".*">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.OltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+        <property name="accumulatorEnabled">true</property>
+    </driver>
+    <driver name="fj-olt" extends="default"
+            manufacturer="Fujitsu" hwVersion="svkOLT" swVersion="v1.0">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.OltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+    </driver>
+    <driver name="nokia-olt" extends="default"
+            manufacturer="Nokia" hwVersion="SDOLT" swVersion="5.2.1">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.NokiaOltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+    </driver>
+    <driver name="g.fast" extends="default"
+            manufacturer="TEST1" hwVersion="TEST2" swVersion="TEST3">
+        <behaviour api="org.onosproject.net.behaviour.Pipeliner"
+                   impl="org.opencord.olt.driver.OltPipeline"/>
+        <behaviour api="org.onosproject.net.behaviour.MeterQuery"
+                   impl="org.onosproject.driver.query.FullMetersAvailable"/>
+    </driver>
+</drivers>
+
diff --git a/impl/src/main/resources/vlan_cfg.json b/impl/src/main/resources/vlan_cfg.json
new file mode 100644
index 0000000..3bb577f
--- /dev/null
+++ b/impl/src/main/resources/vlan_cfg.json
@@ -0,0 +1,131 @@
+{
+  "apps" : {
+    "org.opencord.sadis" : {
+      "sadis" : {
+        "integration" : {
+          "cache" : {
+            "enabled" : true,
+            "maxsize" : 60,
+            "ttl" : "PT1m"
+          }
+        },
+        "entries" : [ {
+          "id" : "s1-eth1",
+          "nasPortId" : "s1-eth1",
+          "uniTagList": [
+            {
+              "uniTagMatch": 35,
+              "ponCTag":33,
+              "ponSTag":7,
+              "technologyProfileId": 2,
+              "upstreamBandwidthProfile":"High-Speed-Internet",
+              "downstreamBandwidthProfile":"Service1"
+            },
+            {
+              "uniTagMatch": 45,
+              "ponCTag":43,
+              "ponSTag":10,
+              "technologyProfileId": 3,
+              "upstreamBandwidthProfile":"VOIP",
+              "downstreamBandwidthProfile":"Service2",
+              "isDhcpRequired":"true"
+            },
+            {
+              "uniTagMatch": 55,
+              "ponCTag": 55,
+              "ponSTag": 550,
+              "technologyProfileId": 4,
+              "upstreamBandwidthProfile": "VOD",
+              "downstreamBandwidthProfile": "Service3",
+              "isDhcpRequired": "true",
+              "isIgmpRequired": "true"
+            },
+            {
+              "ponCTag": 55,
+              "ponSTag": 555,
+              "dsPonCTagPriority": 5,
+              "dsPonSTagPriority": 5,
+              "technologyProfileId": 4,
+              "serviceName": "MC"
+            }
+          ]
+        }, {
+          "id" : "1",
+          "hardwareIdentifier" : "00:00:00:00:00:01",
+          "ipAddress" : "127.0.0.1",
+          "uplinkPort": "2"
+        } ]
+      },
+      "bandwidthprofile":{
+        "integration":{
+          "cache":{
+            "enabled":true,
+            "maxsize":40,
+            "ttl":"PT1m"
+          }
+        },
+        "entries":[
+          {
+            "id":"High-Speed-Internet",
+            "cir": 500000,
+            "cbs": 10000,
+            "eir": 500000,
+            "ebs": 10000,
+            "air": 100000
+          },
+          {
+            "id":"VOIP",
+            "cir": 500000,
+            "cbs": 10000,
+            "eir": 500000,
+            "ebs": 10000,
+            "air": 100000
+          },
+          {
+            "id":"Service1",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Service2",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"VOD",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Service3",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Default",
+            "cir": 0,
+            "cbs": 0,
+            "eir": 512,
+            "ebs": 30,
+            "air": 0
+          }
+        ]
+      }
+    }
+  },
+  "devices":{
+    "of:0000000000000001":{
+      "basic":{
+        "driver":"pmc-olt"
+      }
+    }
+  }
+}
diff --git a/impl/src/main/resources/vlan_cfg_with_default.json b/impl/src/main/resources/vlan_cfg_with_default.json
new file mode 100644
index 0000000..e168283
--- /dev/null
+++ b/impl/src/main/resources/vlan_cfg_with_default.json
@@ -0,0 +1,104 @@
+{
+  "apps" : {
+    "org.opencord.sadis" : {
+      "sadis" : {
+        "integration" : {
+          "cache" : {
+            "enabled" : true,
+            "maxsize" : 60,
+            "ttl" : "PT1m"
+          }
+        },
+        "entries" : [ {
+          "id" : "s1-eth1",
+          "nasPortId" : "s1-eth1",
+          "uniTagList": [
+            {
+              "uniTagMatch": 35,
+              "ponCTag":33,
+              "ponSTag":7,
+              "technologyProfileId": 2,
+              "upstreamBandwidthProfile":"High-Speed-Internet",
+              "downstreamBandwidthProfile":"Service1"
+            }
+          ]
+        }, {
+          "id" : "1",
+          "hardwareIdentifier" : "00:00:00:00:00:01",
+          "ipAddress" : "127.0.0.1",
+          "uplinkPort": "2"
+        } ]
+      },
+      "bandwidthprofile":{
+        "integration":{
+          "cache":{
+            "enabled":true,
+            "maxsize":40,
+            "ttl":"PT1m"
+          }
+        },
+        "entries":[
+          {
+            "id":"High-Speed-Internet",
+            "cir": 500000,
+            "cbs": 10000,
+            "eir": 500000,
+            "ebs": 10000,
+            "air": 100000
+          },
+          {
+            "id":"VOIP",
+            "cir": 500000,
+            "cbs": 10000,
+            "eir": 500000,
+            "ebs": 10000,
+            "air": 100000
+          },
+          {
+            "id":"Service1",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Service2",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"VOD",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Service3",
+            "cir": 600000,
+            "cbs": 10000,
+            "eir": 400000,
+            "ebs": 10000
+          },
+          {
+            "id":"Default",
+            "cir": 0,
+            "cbs": 0,
+            "eir": 512,
+            "ebs": 30,
+            "air": 0
+          }
+        ]
+      }
+    }
+  },
+  "devices":{
+    "of:0000000000000001":{
+      "basic":{
+        "driver":"pmc-olt"
+      }
+    }
+  }
+}