blob: ac50bfe8a15fafa3122276cdb7d98f5e02bb443e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# Copyright (c) 2017 VMware, Inc.
#
# 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.
import unittest
from vio.pub.vim.vimapi.network.OperateSubnet import OperateSubnet
from vio.pub.vim.vimapi.network.OperateNetwork import OperateNetwork
from vio.pub.vim.vimapi.network.OperatePort import OperatePort
class OperateTest(unittest.TestCase):
def tearDown(self):
pass
def test_operatenetwork(self):
class Network:
def __init__(self, status):
self.status = status
network = Network("ok")
network.id = 1
network.name = "name1"
network.project_id = 2
network.provider_segmentation_id = 3
network.provider_network_type = 4
network.provider_physical_network = 5
network.is_shared = 6
network.is_router_external = 7
op = OperateNetwork()
self.assertDictContainsSubset({"status": "ok"}, op._convert(network))
def test_operatesubnet(self):
class Subnet:
def __init__(self, status):
self.status = status
subnet = Subnet("ok")
subnet.id = 1
subnet.network_id = 2
subnet.name = "name1"
subnet.allocation_pools = "pool1"
subnet.gateway_ip = "0.0.0.0"
subnet.dns_nameservers = "server1"
subnet.ip_version = "1.0"
subnet.is_dhcp_enabled = "true"
subnet.host_routes = 1
subnet.cidr = 1
os = OperateSubnet()
self.assertDictContainsSubset({"status": "ok"}, os._convert(subnet))
def test_operateport(self):
class Port:
def __init__(self, status):
self.status = status
port = Port("ok")
port.id = 1
port.network_id = 1
port.name = "name"
port.binding_vnic_type = 1
port.mac_address = "aa:aa:aa:aa:aa:aa"
port.subnet_id = 2
port.security_group_ids = 1
port.fixed_ips = [{"subnet_id": 1}]
op = OperatePort()
self.assertDictContainsSubset({"status": "ok"}, op._convert(port))
|