infra: physical network, nsp and traffictypes support

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
diff --git a/docs/api/apis.remaining b/docs/api/apis.remaining
index ebcb174..9ba6b38 100644
--- a/docs/api/apis.remaining
+++ b/docs/api/apis.remaining
@@ -44,15 +44,12 @@
 listLBHealthCheckPolicies
 listLoadBalancers
 listNetworkACLs
-listNetworkServiceProviders
 listPortableIpRanges
-listRegisteredServicePackages
 listStaticRoutes
 listStorageNetworkIpRange
 listStorageProviders
 listStorageTags
 listSupportedNetworkServices
-listTrafficTypes
 listVirtualRouterElements
 listVlanIpRanges
 listVmwareDcs
@@ -64,6 +61,3 @@
 stopInternalLoadBalancerVM
 updateNetworkACLItem
 updateNetworkACLList
-updateNetworkServiceProvider
-updatePhysicalNetwork
-updateTrafficType
diff --git a/src/components/view/ListView.vue b/src/components/view/ListView.vue
index c4f7d22..018d588 100644
--- a/src/components/view/ListView.vue
+++ b/src/components/view/ListView.vue
@@ -85,6 +85,9 @@
     <a slot="publicip" slot-scope="text, record" href="javascript:;">
       <router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
     </a>
+    <a slot="traffictype" slot-scope="text, record" href="javascript:;">
+      <router-link :to="{ path: $route.path + '/' + record.id + '?physicalnetworkid=' + record.physicalnetworkid }">{{ text }}</router-link>
+    </a>
     <a slot="vmname" slot-scope="text, record" href="javascript:;">
       <router-link :to="{ path: '/vm/' + record.virtualmachineid }">{{ text }}</router-link>
     </a>
diff --git a/src/config/section/infra.js b/src/config/section/infra.js
index e89e67a..eb000d0 100644
--- a/src/config/section/infra.js
+++ b/src/config/section/infra.js
@@ -17,6 +17,8 @@
 
 import zones from '@/config/section/infra/zones'
 import phynetworks from '@/config/section/infra/phynetworks'
+import traffictypes from '@/config/section/infra/traffictypes'
+import nsp from '@/config/section/infra/nsp'
 import pods from '@/config/section/infra/pods'
 import clusters from '@/config/section/infra/clusters'
 import hosts from '@/config/section/infra/hosts'
@@ -40,6 +42,8 @@
     },
     zones,
     phynetworks,
+    traffictypes,
+    nsp,
     pods,
     clusters,
     hosts,
diff --git a/src/config/section/infra/nsp.js b/src/config/section/infra/nsp.js
new file mode 100644
index 0000000..7cc2860
--- /dev/null
+++ b/src/config/section/infra/nsp.js
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+export default {
+  name: 'nsp',
+  title: 'Network Service Providers',
+  icon: 'compass',
+  hidden: true,
+  permission: ['listNetworkServiceProviders'],
+  columns: ['name', 'state', 'physicalnetworkid'],
+  details: ['name', 'state', 'servicelist', 'canenableindividualservice', 'physicalnetworkid'],
+  tabs: [{
+    name: 'details',
+    component: () => import('@/components/view/DetailsTab.vue')
+  }],
+  actions: [
+    {
+      api: 'updateNetworkServiceProvider',
+      icon: 'stop',
+      label: 'Disable Provider',
+      dataView: true,
+      args: ['state'],
+      show: (record) => { return record.state === 'Enabled' },
+      mapping: {
+        state: {
+          value: (record) => { return 'Disabled' }
+        }
+      }
+    },
+    {
+      api: 'updateNetworkServiceProvider',
+      icon: 'right-circle',
+      label: 'Enable Provider',
+      dataView: true,
+      args: ['state'],
+      show: (record) => { return record.state === 'Disabled' },
+      mapping: {
+        state: {
+          value: (record) => { return 'Enabled' }
+        }
+      }
+    }
+  ]
+}
diff --git a/src/config/section/infra/phynetworks.js b/src/config/section/infra/phynetworks.js
index aa59add..45835c5 100644
--- a/src/config/section/infra/phynetworks.js
+++ b/src/config/section/infra/phynetworks.js
@@ -23,5 +23,32 @@
   permission: ['listPhysicalNetworks'],
   columns: ['name', 'state', 'isolationmethods', 'vlan', 'broadcastdomainrange', 'zoneid'],
   details: ['name', 'state', 'isolationmethods', 'vlan', 'broadcastdomainrange', 'zoneid'],
-  actions: []
+  tabs: [{
+    name: 'details',
+    component: () => import('@/components/view/DetailsTab.vue')
+  }, {
+    name: 'Network Service Providers',
+    component: () => import('@/views/infra/traffic/NspTab.vue')
+  }, {
+    name: 'Dedicated VLAN/VNI Ranges',
+    component: () => import('@/views/infra/traffic/DedicatedVLANTab.vue')
+  }],
+  related: [{
+    name: 'traffictype',
+    title: 'Traffic Types',
+    param: 'physicalnetworkid'
+  }, {
+    name: 'guestnetwork',
+    title: 'Networks',
+    param: 'physicalnetworkid'
+  }],
+  actions: [
+    {
+      api: 'updatePhysicalNetwork',
+      icon: 'edit',
+      label: 'Update Physical Network',
+      dataView: true,
+      args: ['vlan', 'tags']
+    }
+  ]
 }
diff --git a/src/config/section/infra/traffictypes.js b/src/config/section/infra/traffictypes.js
new file mode 100644
index 0000000..8bad045
--- /dev/null
+++ b/src/config/section/infra/traffictypes.js
@@ -0,0 +1,42 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+export default {
+  name: 'traffictype',
+  title: 'Traffic Types',
+  icon: 'branches',
+  hidden: true,
+  permission: ['listTrafficTypes'],
+  columns: ['traffictype', 'kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'physicalnetworkid'],
+  details: ['traffictype', 'kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'hypervnetworklabel', 'ovm3networklabel', 'physicalnetworkid'],
+  tabs: [{
+    name: 'details',
+    component: () => import('@/components/view/DetailsTab.vue')
+  }, {
+    name: 'IP Ranges',
+    component: () => import('@/views/infra/traffic/IpRangesTab.vue')
+  }],
+  actions: [
+    {
+      api: 'updateTrafficType',
+      icon: 'edit',
+      label: 'Update Traffic Labels',
+      dataView: true,
+      args: ['kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'hypervnetworklabel', 'ovm3networklabel']
+    }
+  ]
+}
diff --git a/src/views/infra/traffic/DedicatedVLANTab.vue b/src/views/infra/traffic/DedicatedVLANTab.vue
new file mode 100644
index 0000000..992f81a
--- /dev/null
+++ b/src/views/infra/traffic/DedicatedVLANTab.vue
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+<template>
+  <a-spin :spinning="fetchLoading">
+    listDedicatedGuestVlanRanges here
+  </a-spin>
+</template>
+
+<script>
+
+export default {
+  name: 'DedicatedVLANTab',
+  props: {
+    resource: {
+      type: Object,
+      required: true
+    },
+    loading: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      fetchLoading: false
+    }
+  },
+  mounted () {
+    this.fetchData()
+  },
+  watch: {
+    loading (newData, oldData) {
+      if (!newData && this.resource.id) {
+        this.fetchData()
+      }
+    }
+  },
+  methods: {
+    fetchData () {
+      // List existing IP range etc.
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+
+</style>
diff --git a/src/views/infra/traffic/IpRangesTab.vue b/src/views/infra/traffic/IpRangesTab.vue
new file mode 100644
index 0000000..41257f1
--- /dev/null
+++ b/src/views/infra/traffic/IpRangesTab.vue
@@ -0,0 +1,63 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+<template>
+  <a-spin :spinning="fetchLoading">
+    IP Ranges Tab here
+  </a-spin>
+</template>
+
+<script>
+
+export default {
+  name: 'IpRangesTab',
+  props: {
+    resource: {
+      type: Object,
+      required: true
+    },
+    loading: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      fetchLoading: false
+    }
+  },
+  mounted () {
+    this.fetchData()
+  },
+  watch: {
+    loading (newData, oldData) {
+      if (!newData && this.resource.id) {
+        this.fetchData()
+      }
+    }
+  },
+  methods: {
+    fetchData () {
+      // List existing IP range etc.
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+
+</style>
diff --git a/src/views/infra/traffic/NspTab.vue b/src/views/infra/traffic/NspTab.vue
new file mode 100644
index 0000000..f47c85f
--- /dev/null
+++ b/src/views/infra/traffic/NspTab.vue
@@ -0,0 +1,84 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you 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.
+
+<template>
+  <a-spin :spinning="fetchLoading">
+    <a-list size="small">
+      <a-list-item v-for="(nsp, index) in nsps" :key="index">
+        <status :text="nsp.state" />
+        <router-link :to="{ path: '/nsp/' + nsp.id + '?name=' + nsp.name + '&physicalnetworkid=' + resource.id }">{{ nsp.name }} </router-link>
+      </a-list-item>
+    </a-list>
+  </a-spin>
+</template>
+
+<script>
+import { api } from '@/api'
+import Status from '@/components/widgets/Status'
+
+export default {
+  name: 'NspTab',
+  components: {
+    Status
+  },
+  props: {
+    resource: {
+      type: Object,
+      required: true
+    },
+    loading: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    return {
+      nsps: {},
+      fetchLoading: false
+    }
+  },
+  mounted () {
+    this.fetchData()
+  },
+  watch: {
+    loading (newData, oldData) {
+      if (!newData && this.resource.id) {
+        this.fetchData()
+      }
+    }
+  },
+  methods: {
+    fetchData () {
+      this.fetchLoading = true
+      api('listNetworkServiceProviders', { physicalnetworkid: this.resource.id }).then(json => {
+        this.nsps = json.listnetworkserviceprovidersresponse.networkserviceprovider
+      }).catch(error => {
+        this.$notification.error({
+          message: 'Request Failed',
+          description: error.response.headers['x-description']
+        })
+      }).finally(() => {
+        this.fetchLoading = false
+      })
+    }
+  }
+}
+</script>
+
+<style lang="less" scoped>
+
+</style>