Fix a 'memeber' typo
[integration/test.git] / 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 BaseSwitch
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 [
35             "\rstartup saved-configuration odl_test_startup_config.cfg main\r",
36             "reboot\r",
37             "Y\r",
38             "\r",
39             "N\r",
40             "Y\r",
41         ]
42
43     @property
44     def cleanup_cmds(self):
45         return [
46             "system-view",
47             "undo openflow instance " + self.of_instance_id,
48             "return",
49         ]
50
51     @property
52     def base_openflow_config(self):
53         return [
54             "system-view",
55             "openflow instance " + self.of_instance_id,
56             "classification vlan 1",
57             "controller "
58             + self.of_instance_id
59             + " address ip "
60             + self.of_controller_ip,
61             "active instance",
62             "return",
63         ]
64
65     @property
66     def openflow_enable_config(self):
67         return [
68             "system-view",
69             "openflow instance " + self.of_instance_id,
70             "classification vlan 1",
71             "active instance",
72             "return",
73         ]
74
75     @property
76     def openflow_validation_cmd(self):
77         return "display openflow summary"
78
79     @property
80     def openflow_enable_validations(self):
81         return [self.of_instance_id + " +Active", "Connected   1          24        N"]
82
83     @property
84     def openflow_disable_config(self):
85         return [
86             "system-view",
87             "openflow instance " + self.of_instance_id,
88             "undo classification",
89             "active instance",
90             "return",
91         ]
92
93     @property
94     def openflow_disable_validations(self):
95         return [self.of_instance_id + " +Inactive  - +- +- +- +-"]
96
97     @property
98     def dump_all_flows(self):
99         return [""]
100
101     @property
102     def datapath_id_output_command(self):
103         return "display openflow summary | include 0x"
104
105     datapath_id_output_string = ""
106     datapath_id = ""
107
108     def update_datapath_id(self):
109         if not self.datapath_id_output_string:
110             self.datapath_id = "unknown"
111         else:
112             # 21    Active    0x0015cc3e5f42ad23  Connected   1          24        N
113             # |---------------------------------(0)---------------------------------|
114             # |------(1)-------||------(2)-----|
115             matches = re.search(
116                 "(.*0x)(\w+) +Connected", self.datapath_id_output_string
117             )
118             datapath_id_hex = matches.group(2)
119             self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)