Step 1: Move vm scripts to the right place
[integration/test.git] / test / csit / libraries / SwitchClasses / H3C.py
1 """
2 Provision 3800 Object Definition
3 Authors: james.luhrsen@hp.com
4 Created: 2014-10-02
5 """
6 import re
7 from BaseSwitch import *  # noqa
8
9
10 class H3C(BaseSwitch):
11     '''
12     H3C Super Class
13     '''
14
15     make = 'h3c'
16     model = ''
17
18     mgmt_protocol = 'telnet'
19     mgmt_ip = ''
20     mgmt_port = ''
21     mgmt_prompt = '(' + model + '.*>|' + model + '.*])'
22
23     initialization_type = 'reboot'
24
25     of_controller_ip = ''
26     of_instance_id = '21'
27
28     @property
29     def connection_configs(self):
30         return ['\r\r\r']
31
32     @property
33     def initialization_cmds(self):
34         return ['\rstartup saved-configuration odl_test_startup_config.cfg main\r',
35                 'reboot\r',
36                 'Y\r',
37                 '\r',
38                 'N\r',
39                 'Y\r']
40
41     @property
42     def cleanup_cmds(self):
43         return ['system-view',
44                 'undo openflow instance ' + self.of_instance_id,
45                 'return']
46
47     @property
48     def base_openflow_config(self):
49         return ['system-view',
50                 'openflow instance ' + self.of_instance_id,
51                 'classification vlan 1',
52                 'controller ' + self.of_instance_id + ' address ip ' + self.of_controller_ip,
53                 'active instance',
54                 'return']
55
56     @property
57     def openflow_enable_config(self):
58         return ['system-view',
59                 'openflow instance ' + self.of_instance_id,
60                 'classification vlan 1',
61                 'active instance',
62                 'return']
63
64     @property
65     def openflow_validation_cmd(self):
66         return 'display openflow summary'
67
68     @property
69     def openflow_enable_validations(self):
70         return [self.of_instance_id + ' +Active',
71                 'Connected   1          24        N']
72
73     @property
74     def openflow_disable_config(self):
75         return ['system-view',
76                 'openflow instance ' + self.of_instance_id,
77                 'undo classification',
78                 'active instance',
79                 'return']
80
81     @property
82     def openflow_disable_validations(self):
83         return [self.of_instance_id + ' +Inactive  - +- +- +- +-']
84
85     @property
86     def dump_all_flows(self):
87         return ['']
88
89     @property
90     def datapath_id_output_command(self):
91         return 'display openflow summary | include 0x'
92
93     datapath_id_output_string = ''
94     datapath_id = ''
95
96     def update_datapath_id(self):
97         if not self.datapath_id_output_string:
98             self.datapath_id = 'unknown'
99         else:
100             # 21    Active    0x0015cc3e5f42ad23  Connected   1          24        N
101             # |---------------------------------(0)---------------------------------|
102             # |------(1)-------||------(2)-----|
103             matches = re.search('(.*0x)(\w+) +Connected', self.datapath_id_output_string)
104             datapath_id_hex = matches.group(2)
105             self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)