Debian Codegraph @

neutron_taas/tests/base.py

raw
1 # Copyright (C) 2018 AT&T
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 import copy
16
17 from oslotest import base
18
19
20 FAKE_PORT_PARAMS = {
21 'mac': '52:54:00:12:35:02', 'pci_slot': 3, 'vf_index': '89',
22 'pf_device': 'net_enp0s3_52_54_00_12_35_02', 'src_vlans': '20'}
23
24 FAKE_TAP_SERVICE = {
25 'taas_id': '1234',
26 'port': {
27 'id': 'fake_1',
28 'mac_address': "52:54:00:12:35:02",
29 'binding:profile': {'pci_slot': 3},
30 'binding:vif_details': {'vlan': '20'}
31 }
32 }
33
34 FAKE_OF_PORT = {
35 'port_name': 'tap4321',
36 'ofport': 12,
37 }
38 FAKE_PORT_DICT = {
39 FAKE_OF_PORT['port_name']: 4
40 }
41 FAKE_TAP_SERVICE_OVS = {
42 'taas_id': 4321,
43 'port': {
44 'id': 'fake_2',
45 'mac_address': "fa:16:3e:33:0e:d4",
46 'binding:profile': {},
47 'binding:vif_details': {
48 'connectivity': 'l2',
49 'port_filter': True,
50 'ovs_hybrid_plug': False,
51 'datapath_type': 'system',
52 'bridge_name': 'br-int'
53 }
54 }
55 }
56
57 FAKE_TAP_FLOW = {
58 'taas_id': FAKE_TAP_SERVICE_OVS['taas_id'],
59 'port': FAKE_TAP_SERVICE['port'],
60 'port_mac': 'fa:16:3e:5c:67:6a',
61 'ts_port': FAKE_TAP_SERVICE['port'],
62 'source_vlans_list': ['4-6', '8-10', '15-18,20'],
63 'vlan_filter_list': '1-5,9,18,20,27-30,4000-4095',
64 'tap_flow': {
65 'direction': 'IN', 'vlan_filter': '20'
66 }
67 }
68
69
70 FAKE_TAP_MIRROR_OUT = {
71 'tap_mirror': {
72 'id': 'mirror_uuid',
73 'port_id': 'port_uuid',
74 'directions': {'OUT': '102'},
75 'remote_ip': '100.109.0.48',
76 'mirror_type': 'gre',
77 },
78 'port': {
79 'id': 'port_uuid',
80 'mac_address': 'fa:16:3e:69:0e:f3',
81 }
82 }
83
84 FAKE_TAP_MIRROR_IN = copy.deepcopy(FAKE_TAP_MIRROR_OUT)
85 FAKE_TAP_MIRROR_IN['tap_mirror']['directions'] = {'IN': '101'}
86
87
88 class TaasTestCase(base.BaseTestCase):
89 """Test case base class for all unit tests."""