Merge "Increasing timers for this test after stats mgr improvements"
[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 string
7 import robot
8 import re
9 from robot.libraries.BuiltIn import BuiltIn
10 from BaseSwitch import *
11
12 class H3C(BaseSwitch):
13     '''
14     H3C Super Class
15     '''
16
17     make = 'h3c'
18     model = ''
19
20     mgmt_protocol = 'telnet'
21     mgmt_ip = ''
22     mgmt_port = ''
23     mgmt_prompt = '(' + model + '.*>|' + model + '.*])'
24
25
26     initialization_type = 'reboot'
27
28     of_controller_ip = ''
29     of_instance_id = '21'
30
31     @property
32     def connection_configs(self):
33         return \
34             ['\r\r\r']
35
36     @property
37     def initialization_cmds(self):
38         return \
39             ['\rstartup saved-configuration odl_test_startup_config.cfg main\r', \
40              'reboot\r', \
41              'Y\r', \
42              '\r', \
43              'N\r', \
44              'Y\r']
45
46     @property
47     def cleanup_cmds(self):
48         return \
49             ['system-view', \
50              'undo openflow instance ' + self.of_instance_id, \
51              'return']
52
53     @property
54     def base_openflow_config(self):
55         return \
56             ['system-view', \
57              'openflow instance ' + self.of_instance_id, \
58              'classification vlan 1', \
59              'controller ' + self.of_instance_id + ' address ip ' + self.of_controller_ip, \
60              'active instance', \
61              'return']
62
63     @property
64     def openflow_enable_config(self):
65         return \
66             ['system-view', \
67              'openflow instance ' + self.of_instance_id, \
68              'classification vlan 1', \
69              'active instance', \
70              'return']
71
72     @property
73     def openflow_validation_cmd(self):
74         return \
75             'display openflow summary'
76
77     @property
78     def openflow_enable_validations(self):
79         return \
80             [self.of_instance_id + ' +Active', \
81              '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     @property
93     def openflow_disable_validations(self):
94         return \
95             [self.of_instance_id + ' +Inactive  - +- +- +- +-']
96
97     @property
98     def dump_all_flows(self):
99         return \
100             ['']
101
102     @property
103     def datapath_id_output_command(self):
104         return \
105             'display openflow summary | include 0x'
106
107     datapath_id_output_string = ''
108     datapath_id = ''
109
110     def update_datapath_id(self):
111         if not self.datapath_id_output_string:
112             self.datapath_id = 'unknown'
113         else:
114          #21    Active    0x0015cc3e5f42ad23  Connected   1          24        N
115          #|---------------------------------(0)---------------------------------|
116          #|------(1)-------||------(2)-----|
117          matches = re.search('(.*0x)(\w+) +Connected', self.datapath_id_output_string)
118          datapath_id_hex = matches.group(2)
119          self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)