Adding support for maple olt
Adding copyright headers to missing files
Change-Id: Ia3f562f3196bb775841c31c7a276c59f8786dcec
diff --git a/src/test/apps/ciena-cordigmp.multi-table/src/main/java/org/ciena/cordigmp/package-info.java b/src/test/apps/ciena-cordigmp.multi-table/src/main/java/org/ciena/cordigmp/package-info.java
index 75494c5..7214bf7 100644
--- a/src/test/apps/ciena-cordigmp.multi-table/src/main/java/org/ciena/cordigmp/package-info.java
+++ b/src/test/apps/ciena-cordigmp.multi-table/src/main/java/org/ciena/cordigmp/package-info.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015-2016 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.
+ */
+
 /**
  * Ciena application for cord tester to provision flows with ovs.
  * This is required as OVS onos driver does not support multi-table inserts.
diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/IgmpPortPair.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/IgmpPortPair.java
index 176cac9..a3a6706 100644
--- a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/IgmpPortPair.java
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/IgmpPortPair.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2015-2016 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.
+ */
 package org.ciena.cordigmp;
 
 public class IgmpPortPair {
@@ -17,4 +32,3 @@
         return outputPort;
     }
 }
-
diff --git a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java
index 75494c5..7214bf7 100644
--- a/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java
+++ b/src/test/apps/ciena-cordigmp/src/main/java/org/ciena/cordigmp/package-info.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2015-2016 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.
+ */
+
 /**
  * Ciena application for cord tester to provision flows with ovs.
  * This is required as OVS onos driver does not support multi-table inserts.
diff --git a/src/test/utils/CordTestConfig.py b/src/test/utils/CordTestConfig.py
index 2ec54d9..0d14239 100644
--- a/src/test/utils/CordTestConfig.py
+++ b/src/test/utils/CordTestConfig.py
@@ -96,6 +96,7 @@
                         config_fake = False,
                         olt_type = 'ponsim_olt',
                         olt_mac = '00:0c:e2:31:12:00',
+                        olt_ip = None,
                         uplink_vlan_map = { 'of:0000000000000001' : '222' },
                         uplink_vlan_start = 333
                         )
diff --git a/src/test/utils/VolthaCtrl.py b/src/test/utils/VolthaCtrl.py
index bbe303e..644d487 100644
--- a/src/test/utils/VolthaCtrl.py
+++ b/src/test/utils/VolthaCtrl.py
@@ -243,7 +243,10 @@
         if olt_mac is not None:
             device_config = { 'type' : olt_type, 'mac_address' : olt_mac }
         else:
-            device_config = { 'type' : olt_type, 'host_and_port' : address }
+            if len(address.split(':')) > 1:
+                device_config = { 'type' : olt_type, 'host_and_port' : address }
+            else:
+                device_config = { 'type' : olt_type, 'ipv4_address' : address }
         #pre-provision
         if olt_mac is not None:
             log.info('Pre-provisioning %s with mac %s' %(olt_type, olt_mac))
@@ -344,7 +347,7 @@
     olt_app_file = os.path.join(our_path, '..', 'apps/olt-app-{}.oar'.format(olt_app_version))
     return olt_app_file
 
-def voltha_setup(host = '172.17.0.1', rest_port = VolthaCtrl.REST_PORT,
+def voltha_setup(host = '172.17.0.1', olt_ip = None, rest_port = VolthaCtrl.REST_PORT,
                  olt_type = 'ponsim_olt', olt_mac = '00:0c:e2:31:12:00',
                  uplink_vlan_map = VolthaCtrl.UPLINK_VLAN_MAP,
                  uplink_vlan_start = VolthaCtrl.UPLINK_VLAN_START,
@@ -358,8 +361,15 @@
         log.info('Enabling ponsim olt')
         device_id, status = voltha.enable_device(olt_type, address = ponsim_address)
     else:
-        log.info('Enabling OLT instance for %s with mac %s' %(olt_type, olt_mac))
-        device_id, status = voltha.enable_device(olt_type, olt_mac)
+        if olt_type.startswith('maple'):
+            if olt_ip:
+                log.info('Enabling %s' %olt_type)
+                device_id, status = voltha.enable_device(olt_type, address = olt_ip)
+            else:
+                log.info('OLT IP needs to be specified for maple olt')
+        else:
+            log.info('Enabling OLT instance for %s with mac %s' %(olt_type, olt_mac))
+            device_id, status = voltha.enable_device(olt_type, olt_mac)
 
     if device_id is None or status is False:
         if device_id:
diff --git a/src/test/voltha/volthaTest.py b/src/test/voltha/volthaTest.py
index ff4b1b0..a705519 100644
--- a/src/test/voltha/volthaTest.py
+++ b/src/test/voltha/volthaTest.py
@@ -267,7 +267,7 @@
     VOLTHA_UPLINK_VLAN_MAP = { 'of:0000000000000001' : '222' }
     VOLTHA_UPLINK_VLAN_START = 444
     VOLTHA_ONU_UNI_PORT = 'veth0'
-
+    VOLTHA_OLT_IP = None
     dhcp_server_config = {
        "ip": "10.1.11.50",
        "mac": "ca:fe:ca:fe:ca:fe",
@@ -1478,8 +1478,16 @@
              if device_id != '':
                 self.olt_device_id = device_id
           else:
-             log_test.info('This setup test cases is developed on ponsim olt only, hence stop execution')
-             assert_equal(False, True)
+             if self.VOLTHA_OLT_TYPE.startswith('maple'):
+                   if self.VOLTHA_OLT_IP:
+                         address = self.VOLTHA_OLT_IP
+                         log_test.info('Enabling maple olt')
+                         device_id, status = voltha.enable_device(self.VOLTHA_OLT_TYPE, address = address)
+                   else:
+                         log_test.info('VOLTHA OLT IP needs to be specified for maple olt')
+             else:
+                   log_test.info('This setup test cases is developed for ponsim or maple olt only, hence stop execution')
+                   assert_equal(False, True)
 
           assert_not_equal(device_id, None)
           if status == False:
@@ -1613,6 +1621,18 @@
         finally:
             self.voltha.disable_device(device_id, delete = True)
 
+    def test_maple_enable_disable(self):
+        log_test.info('Enabling maple olt')
+        if self.VOLTHA_OLT_IP:
+              address = self.VOLTHA_OLT_IP
+              device_id, status = self.voltha.enable_device('maple_olt', address = address)
+              assert_not_equal(device_id, None)
+              try:
+                    assert_equal(status, True)
+                    time.sleep(10)
+              finally:
+                    self.voltha.disable_device(device_id, delete = True)
+
     def test_subscriber_with_voltha_for_eap_tls_authentication(self):
         """
         Test Method: