ONOS-7629 - minimal support for Ciena 51xx devices

Change-Id: I19408f558c1766686b8e567ae27e3077db782cf3
diff --git a/drivers/ciena/c5162/src/main/resources/ciena-5162-drivers.xml b/drivers/ciena/c5162/src/main/resources/ciena-5162-drivers.xml
new file mode 100644
index 0000000..c0bcc4d
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/ciena-5162-drivers.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright 2018-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="ciena-5162-netconf" manufacturer="Ciena" hwVersion="1.0.0" swVersion="1.0.0">
+        <behaviour api="org.onosproject.net.device.DeviceDescriptionDiscovery"
+            impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162DeviceDescription"/>
+        <behaviour api="org.onosproject.net.behaviour.PortAdmin"
+           impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162PortAdmin"/>
+        <behaviour api="org.onosproject.net.device.PortStatisticsDiscovery"
+            impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162DeviceDescription"/>
+        <behaviour api="org.onosproject.net.behaviour.LinkDiscovery"
+            impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162DeviceDescription"/>
+<!--
+        <behaviour api="org.onosproject.net.flow.FlowRuleProgrammable"
+                   impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162FlowRuleProgrammable"/>
+        <behaviour api="org.onosproject.net.behaviour.LambdaQuery"
+                   impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162LambdaQuery"/>
+        <behaviour api="org.onosproject.incubator.net.faultmanagement.alarm.AlarmConsumer"
+                   impl="org.onosproject.drivers.ciena.c5162.netconf.Ciena5162AlarmConsumer"/>
+-->
+    </driver>
+</drivers>
+
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/link-info.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/link-info.j2
new file mode 100644
index 0000000..b43f85f
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/link-info.j2
@@ -0,0 +1,16 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+  <get>
+    <filter type="subtree">
+      <oc-if:interfaces xmlns:oc-if="http://openconfig.net/yang/interfaces" xmlns:c-pn="urn:ciena:params:xml:ns:yang:ciena-pn::ciena-ieee-lldp">
+        <oc-if:interface>
+          <oc-if:config>
+            <tt:type xmlns:tt="http://ciena.com/ns/yang/ciena-openconfig-interfaces" />
+          </oc-if:config>
+          <oc-if:state>
+            <c-pn:lldp-remote-port-operational/>
+          </oc-if:state>
+        </oc-if:interface>
+      </oc-if:interfaces>
+    </filter>
+  </get>
+</rpc>
\ No newline at end of file
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPort.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPort.j2
new file mode 100644
index 0000000..2e7223e
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPort.j2
@@ -0,0 +1,11 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+  <get>
+    <filter type="subtree">
+      <oc-if:interfaces xmlns:oc-if="http://openconfig.net/yang/interfaces">
+        <oc-if:interface>
+          <oc-if:name>{{port-number}}</oc-if:name>
+        </oc-if:interface>
+      </oc-if:interfaces>
+    </filter>
+  </get>
+</rpc>
\ No newline at end of file
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPorts.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPorts.j2
new file mode 100644
index 0000000..bd2a0c0
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/logicalPorts.j2
@@ -0,0 +1,9 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+  <get>
+    <filter type="subtree">
+      <oc-if:interfaces xmlns:oc-if="http://openconfig.net/yang/interfaces">
+        <oc-if:interface/>
+      </oc-if:interfaces>
+    </filter>
+  </get>
+</rpc>
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/port-admin-state.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/port-admin-state.j2
new file mode 100644
index 0000000..3d0b02b
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/port-admin-state.j2
@@ -0,0 +1,17 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <edit-config>
+        <target>
+            <running />
+        </target>
+        <config>
+            <interfaces xmlns="http://openconfig.net/yang/interfaces" xmlns:ncx="http://netconfcentral.org/ns/yuma-ncx">
+                <interface>
+                    <name>{{port-number}}</name>
+                    <config>
+                        <admin-status xmlns="http://ciena.com/ns/yang/ciena-openconfig-interfaces">{{admin-state}}</admin-status>
+                    </config>
+                </interface>
+            </interfaces>
+        </config>
+    </edit-config>
+</rpc>
\ No newline at end of file
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/port-stats.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/port-stats.j2
new file mode 100644
index 0000000..e416a9e
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/port-stats.j2
@@ -0,0 +1,16 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <get>
+        <filter type="subtree">
+            <oc-if:interfaces xmlns:oc-if="http://openconfig.net/yang/interfaces">
+                <oc-if:interface>
+                    <oc-if:config>
+                        <tt:type xmlns:tt="http://ciena.com/ns/yang/ciena-openconfig-interfaces" />
+                    </oc-if:config>
+                    <oc-if:state>
+                        <oc-if:counters />
+                    </oc-if:state>
+                </oc-if:interface>
+            </oc-if:interfaces>
+        </filter>
+    </get>
+</rpc>
\ No newline at end of file
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/softwareVersion.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/softwareVersion.j2
new file mode 100644
index 0000000..4b17bb4
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/softwareVersion.j2
@@ -0,0 +1,11 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+  <get>
+    <filter type="subtree">
+      <ciena-software-mgmt:software-state xmlns:ciena-software-mgmt="http://www.ciena.com/ns/yang/ciena-software-mgmt">
+        <ciena-software-mgmt:running-package>
+          <ciena-software-mgmt:package-version/>
+        </ciena-software-mgmt:running-package>
+      </ciena-software-mgmt:software-state>
+    </filter>
+  </get>
+</rpc>
diff --git a/drivers/ciena/c5162/src/main/resources/templates/requests/systemInfo.j2 b/drivers/ciena/c5162/src/main/resources/templates/requests/systemInfo.j2
new file mode 100644
index 0000000..ba8203f
--- /dev/null
+++ b/drivers/ciena/c5162/src/main/resources/templates/requests/systemInfo.j2
@@ -0,0 +1,22 @@
+<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+  <get>
+    <filter type="subtree">
+      <oc-platform:components xmlns:oc-platform="http://openconfig.net/yang/platform">
+        <oc-platform:component>
+          <oc-platform:name>5162</oc-platform:name>
+          <oc-platform:state>
+            <oc-platform:name/>
+            <oc-platform:mfg-name/>
+            <oc-platform:serial-no/>
+            <oc-platform:version/>
+          </oc-platform:state>
+          <oc-platform:properties>
+            <oc-platform:property>
+                <oc-platform:name>base-mac</oc-platform:name>
+            </oc-platform:property>
+          </oc-platform:properties>
+        </oc-platform:component>
+      </oc-platform:components>
+    </filter>
+  </get>
+</rpc>