Authors: james.luhrsen@hp.com
Created: 2014-10-02
"""
-import string
-import robot
import re
-from robot.libraries.BuiltIn import BuiltIn
-from BaseSwitch import *
+from BaseSwitch import * # noqa
+
class ProVision(BaseSwitch):
'''
@property
def connection_configs(self):
- return \
- ['\rend \
- \rconfig \
- \rconsole local-terminal none \
- \rno page \
- \rend\r']
+ return ['\rend \
+ \rconfig \
+ \rconsole local-terminal none \
+ \rno page \
+ \rend\r']
@property
def initialization_cmds(self):
- return \
- ['\rend\rboot system flash primary config odl_test_startup_config\r', \
- 'y', \
- 'n']
+ return ['\rend\rboot system flash primary config odl_test_startup_config\r',
+ 'y',
+ 'n']
@property
def cleanup_cmds(self):
- return \
- ['end', \
- 'config', \
- 'no openflow\r \
- y']
+ return ['end',
+ 'config',
+ 'no openflow\r'
+ 'y']
@property
def base_openflow_config(self):
- return \
- 'end', \
- 'config', \
- 'openflow', \
- 'controller-id ' + self.of_instance_id + ' ip ' + self.of_controller_ip + \
- ' controller-interface oobm', \
- 'instance ' + self.of_instance_id, \
- 'member vlan 10', \
- 'controller-id ' + self.of_instance_id + ' ', \
- 'version 1.3', \
- 'enable', \
- 'openflow enable', \
- 'end'
+ return 'end', \
+ 'config', \
+ 'openflow', \
+ 'controller-id ' + self.of_instance_id + ' ip ' + self.of_controller_ip + \
+ ' controller-interface oobm', \
+ 'instance ' + self.of_instance_id, \
+ 'member vlan 10', \
+ 'controller-id ' + self.of_instance_id + ' ', \
+ 'version 1.3', \
+ 'enable', \
+ 'openflow enable', \
+ 'end'
@property
def openflow_enable_config(self):
- return \
- ['end', \
- 'config', \
- 'openflow enable', \
- 'end']
+ return ['end',
+ 'config',
+ 'openflow enable',
+ 'end']
@property
def openflow_validation_cmd(self):
@property
def openflow_enable_validations(self):
- return \
- ['OpenFlow +: Enabled', \
- self.of_instance_id + ' +Up +2 +1 +1.3']
+ return ['OpenFlow +: Enabled',
+ self.of_instance_id + ' +Up +2 +1 +1.3']
@property
def openflow_disable_config(self):
- return \
- ['end', \
- 'config', \
- 'openflow disable', \
- 'end']
+ return ['end',
+ 'config',
+ 'openflow disable',
+ 'end']
@property
def openflow_disable_validations(self):
- return \
- ['OpenFlow +: Disabled', \
- self.of_instance_id + ' +Down +0 +0 +1.3']
+ return ['OpenFlow +: Disabled', self.of_instance_id + ' +Down +0 +0 +1.3']
@property
def dump_all_flows(self):
- return \
- 'show openflow instance ' + self.of_instance_id + ' flows'
+ return 'show openflow instance ' + self.of_instance_id + ' flows'
@property
def flow_validations(self):
- return \
- ['(?ms)Flow Table ID : 0.*Flow Table ID : 100.*' + \
- 'Source Protocol Address : ' + self.ip_src + '.*' + \
- 'Target Protocol Address : ' + self.ip_dst + '.*' + \
- 'Flow Table ID : ' + self.table_id + '.*' + self.action, \
- 'Source MAC : ' + self.src_mac, \
- 'Destination MAC : ' + self.dst_mac]
+ return ['(?ms)Flow Table ID : 0.*Flow Table ID : 100.*' +
+ 'Source Protocol Address : ' + self.ip_src + '.*' +
+ 'Target Protocol Address : ' + self.ip_dst + '.*' +
+ 'Flow Table ID : ' + self.table_id + '.*' + self.action,
+ 'Source MAC : ' + self.src_mac,
+ 'Destination MAC : ' + self.dst_mac]
def create_flow_match_elements(self, flow_xml):
super(ProVision, self).create_flow_match_elements(flow_xml)
if not self.datapath_id_output_string:
self.datapath_id = 'unknown'
else:
- #Datapath ID : 000af0921c22bac0
- #|-----------------(0)---------------------|
- #|-----------(1)----------| |------(2)-----|
- matches = re.search('(.*: )(\w+)', self.datapath_id_output_string)
- datapath_id_hex = matches.group(2)
- self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)
+ # Datapath ID : 000af0921c22bac0
+ # |-----------------(0)---------------------|
+ # |-----------(1)----------| |------(2)-----|
+ matches = re.search('(.*: )(\w+)', self.datapath_id_output_string)
+ datapath_id_hex = matches.group(2)
+ self.datapath_id = self.convert_hex_to_decimal_as_string(datapath_id_hex)