Skip to content

Commit 3e09296

Browse files
committed
infra: physical network, nsp and traffictypes support
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 291060a commit 3e09296

9 files changed

Lines changed: 345 additions & 7 deletions

File tree

ui/docs/api/apis.remaining

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,12 @@ listInternalLoadBalancerVMs
4444
listLBHealthCheckPolicies
4545
listLoadBalancers
4646
listNetworkACLs
47-
listNetworkServiceProviders
4847
listPortableIpRanges
49-
listRegisteredServicePackages
5048
listStaticRoutes
5149
listStorageNetworkIpRange
5250
listStorageProviders
5351
listStorageTags
5452
listSupportedNetworkServices
55-
listTrafficTypes
5653
listVirtualRouterElements
5754
listVlanIpRanges
5855
listVmwareDcs
@@ -64,6 +61,3 @@ startInternalLoadBalancerVM
6461
stopInternalLoadBalancerVM
6562
updateNetworkACLItem
6663
updateNetworkACLList
67-
updateNetworkServiceProvider
68-
updatePhysicalNetwork
69-
updateTrafficType

ui/src/components/view/ListView.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585
<a slot="publicip" slot-scope="text, record" href="javascript:;">
8686
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
8787
</a>
88+
<a slot="traffictype" slot-scope="text, record" href="javascript:;">
89+
<router-link :to="{ path: $route.path + '/' + record.id + '?physicalnetworkid=' + record.physicalnetworkid }">{{ text }}</router-link>
90+
</a>
8891
<a slot="vmname" slot-scope="text, record" href="javascript:;">
8992
<router-link :to="{ path: '/vm/' + record.virtualmachineid }">{{ text }}</router-link>
9093
</a>

ui/src/config/section/infra.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
import zones from '@/config/section/infra/zones'
1919
import phynetworks from '@/config/section/infra/phynetworks'
20+
import traffictypes from '@/config/section/infra/traffictypes'
21+
import nsp from '@/config/section/infra/nsp'
2022
import pods from '@/config/section/infra/pods'
2123
import clusters from '@/config/section/infra/clusters'
2224
import hosts from '@/config/section/infra/hosts'
@@ -40,6 +42,8 @@ export default {
4042
},
4143
zones,
4244
phynetworks,
45+
traffictypes,
46+
nsp,
4347
pods,
4448
clusters,
4549
hosts,

ui/src/config/section/infra/nsp.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
export default {
19+
name: 'nsp',
20+
title: 'Network Service Providers',
21+
icon: 'compass',
22+
hidden: true,
23+
permission: ['listNetworkServiceProviders'],
24+
columns: ['name', 'state', 'physicalnetworkid'],
25+
details: ['name', 'state', 'servicelist', 'canenableindividualservice', 'physicalnetworkid'],
26+
tabs: [{
27+
name: 'details',
28+
component: () => import('@/components/view/DetailsTab.vue')
29+
}],
30+
actions: [
31+
{
32+
api: 'updateNetworkServiceProvider',
33+
icon: 'stop',
34+
label: 'Disable Provider',
35+
dataView: true,
36+
args: ['state'],
37+
show: (record) => { return record.state === 'Enabled' },
38+
mapping: {
39+
state: {
40+
value: (record) => { return 'Disabled' }
41+
}
42+
}
43+
},
44+
{
45+
api: 'updateNetworkServiceProvider',
46+
icon: 'right-circle',
47+
label: 'Enable Provider',
48+
dataView: true,
49+
args: ['state'],
50+
show: (record) => { return record.state === 'Disabled' },
51+
mapping: {
52+
state: {
53+
value: (record) => { return 'Enabled' }
54+
}
55+
}
56+
}
57+
]
58+
}

ui/src/config/section/infra/phynetworks.js

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,32 @@ export default {
2323
permission: ['listPhysicalNetworks'],
2424
columns: ['name', 'state', 'isolationmethods', 'vlan', 'broadcastdomainrange', 'zoneid'],
2525
details: ['name', 'state', 'isolationmethods', 'vlan', 'broadcastdomainrange', 'zoneid'],
26-
actions: []
26+
tabs: [{
27+
name: 'details',
28+
component: () => import('@/components/view/DetailsTab.vue')
29+
}, {
30+
name: 'Network Service Providers',
31+
component: () => import('@/views/infra/traffic/NspTab.vue')
32+
}, {
33+
name: 'Dedicated VLAN/VNI Ranges',
34+
component: () => import('@/views/infra/traffic/DedicatedVLANTab.vue')
35+
}],
36+
related: [{
37+
name: 'traffictype',
38+
title: 'Traffic Types',
39+
param: 'physicalnetworkid'
40+
}, {
41+
name: 'guestnetwork',
42+
title: 'Networks',
43+
param: 'physicalnetworkid'
44+
}],
45+
actions: [
46+
{
47+
api: 'updatePhysicalNetwork',
48+
icon: 'edit',
49+
label: 'Update Physical Network',
50+
dataView: true,
51+
args: ['vlan', 'tags']
52+
}
53+
]
2754
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
export default {
19+
name: 'traffictype',
20+
title: 'Traffic Types',
21+
icon: 'branches',
22+
hidden: true,
23+
permission: ['listTrafficTypes'],
24+
columns: ['traffictype', 'kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'physicalnetworkid'],
25+
details: ['traffictype', 'kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'hypervnetworklabel', 'ovm3networklabel', 'physicalnetworkid'],
26+
tabs: [{
27+
name: 'details',
28+
component: () => import('@/components/view/DetailsTab.vue')
29+
}, {
30+
name: 'IP Ranges',
31+
component: () => import('@/views/infra/traffic/IpRangesTab.vue')
32+
}],
33+
actions: [
34+
{
35+
api: 'updateTrafficType',
36+
icon: 'edit',
37+
label: 'Update Traffic Labels',
38+
dataView: true,
39+
args: ['kvmnetworklabel', 'vmwarenetworklabel', 'xennetworklabel', 'hypervnetworklabel', 'ovm3networklabel']
40+
}
41+
]
42+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
<template>
19+
<a-spin :spinning="fetchLoading">
20+
listDedicatedGuestVlanRanges here
21+
</a-spin>
22+
</template>
23+
24+
<script>
25+
26+
export default {
27+
name: 'DedicatedVLANTab',
28+
props: {
29+
resource: {
30+
type: Object,
31+
required: true
32+
},
33+
loading: {
34+
type: Boolean,
35+
default: false
36+
}
37+
},
38+
data () {
39+
return {
40+
fetchLoading: false
41+
}
42+
},
43+
mounted () {
44+
this.fetchData()
45+
},
46+
watch: {
47+
loading (newData, oldData) {
48+
if (!newData && this.resource.id) {
49+
this.fetchData()
50+
}
51+
}
52+
},
53+
methods: {
54+
fetchData () {
55+
// List existing IP range etc.
56+
}
57+
}
58+
}
59+
</script>
60+
61+
<style lang="less" scoped>
62+
63+
</style>
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
<template>
19+
<a-spin :spinning="fetchLoading">
20+
IP Ranges Tab here
21+
</a-spin>
22+
</template>
23+
24+
<script>
25+
26+
export default {
27+
name: 'IpRangesTab',
28+
props: {
29+
resource: {
30+
type: Object,
31+
required: true
32+
},
33+
loading: {
34+
type: Boolean,
35+
default: false
36+
}
37+
},
38+
data () {
39+
return {
40+
fetchLoading: false
41+
}
42+
},
43+
mounted () {
44+
this.fetchData()
45+
},
46+
watch: {
47+
loading (newData, oldData) {
48+
if (!newData && this.resource.id) {
49+
this.fetchData()
50+
}
51+
}
52+
},
53+
methods: {
54+
fetchData () {
55+
// List existing IP range etc.
56+
}
57+
}
58+
}
59+
</script>
60+
61+
<style lang="less" scoped>
62+
63+
</style>
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
<template>
19+
<a-spin :spinning="fetchLoading">
20+
<a-list size="small">
21+
<a-list-item v-for="(nsp, index) in nsps" :key="index">
22+
<status :text="nsp.state" />
23+
<router-link :to="{ path: '/nsp/' + nsp.id + '?name=' + nsp.name + '&physicalnetworkid=' + resource.id }">{{ nsp.name }} </router-link>
24+
</a-list-item>
25+
</a-list>
26+
</a-spin>
27+
</template>
28+
29+
<script>
30+
import { api } from '@/api'
31+
import Status from '@/components/widgets/Status'
32+
33+
export default {
34+
name: 'NspTab',
35+
components: {
36+
Status
37+
},
38+
props: {
39+
resource: {
40+
type: Object,
41+
required: true
42+
},
43+
loading: {
44+
type: Boolean,
45+
default: false
46+
}
47+
},
48+
data () {
49+
return {
50+
nsps: {},
51+
fetchLoading: false
52+
}
53+
},
54+
mounted () {
55+
this.fetchData()
56+
},
57+
watch: {
58+
loading (newData, oldData) {
59+
if (!newData && this.resource.id) {
60+
this.fetchData()
61+
}
62+
}
63+
},
64+
methods: {
65+
fetchData () {
66+
this.fetchLoading = true
67+
api('listNetworkServiceProviders', { physicalnetworkid: this.resource.id }).then(json => {
68+
this.nsps = json.listnetworkserviceprovidersresponse.networkserviceprovider
69+
}).catch(error => {
70+
this.$notification.error({
71+
message: 'Request Failed',
72+
description: error.response.headers['x-description']
73+
})
74+
}).finally(() => {
75+
this.fetchLoading = false
76+
})
77+
}
78+
}
79+
}
80+
</script>
81+
82+
<style lang="less" scoped>
83+
84+
</style>

0 commit comments

Comments
 (0)