Jeremy Ronquillo | 8270549 | 2017-10-18 14:19:55 -0700 | [diff] [blame] | 1 | # /usr/bin/env python |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 2 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 3 | Created on 26-Nov-2012 |
Jeremy Ronquillo | 4d5f1d0 | 2017-10-13 20:23:57 +0000 | [diff] [blame] | 4 | Copyright 2012 Open Networking Foundation (ONF) |
Jeremy Songster | ae01bba | 2016-07-11 15:39:17 -0700 | [diff] [blame] | 5 | |
| 6 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 7 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 8 | or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg> |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 9 | |
| 10 | author:: Raghav Kashyap( raghavkashyap@paxterrasolutions.com ) |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 11 | |
| 12 | |
| 13 | TestON is free software: you can redistribute it and/or modify |
| 14 | it under the terms of the GNU General Public License as published by |
| 15 | the Free Software Foundation, either version 2 of the License, or |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 16 | ( at your option ) any later version. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 17 | |
| 18 | TestON is distributed in the hope that it will be useful, |
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | GNU General Public License for more details. |
| 22 | |
| 23 | You should have received a copy of the GNU General Public License |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 24 | along with TestON. If not, see <http://www.gnu.org/licenses/>. |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 25 | |
| 26 | |
| 27 | |
| 28 | DPCTL driver class provides the basic functions of DPCTL controller |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 29 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 30 | import sys |
| 31 | from drivers.common.cli.toolsdriver import Tools |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 32 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 33 | |
| 34 | class DpctlCliDriver( Tools ): |
| 35 | |
| 36 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 37 | DpctlCliDriver driver class provides the basic functions of DPCTL controller |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 38 | """ |
| 39 | def __init__( self ): |
| 40 | super( DpctlCliDriver, self ).__init__() |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 41 | self.handle = self |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 42 | self.wrapped = sys.modules[ __name__ ] |
| 43 | |
| 44 | def connect( self, **connectargs ): |
| 45 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 46 | for key in connectargs: |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 47 | vars( self )[ key ] = connectargs[ key ] |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 48 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 49 | self.name = self.options[ 'name' ] |
| 50 | |
Jon Hall | fd8ce43 | 2015-07-21 13:07:53 -0700 | [diff] [blame] | 51 | self.handle = super( |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 52 | DpctlCliDriver, self ).connect( user_name=self.user_name, |
Jeremy Ronquillo | 8270549 | 2017-10-18 14:19:55 -0700 | [diff] [blame] | 53 | ip_address=self.ip_address, |
| 54 | port=None, |
| 55 | pwd=self.pwd ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 56 | if self.handle: |
| 57 | main.log.info( "Connected to the host" ) |
| 58 | return main.TRUE |
| 59 | else: |
| 60 | main.log.error( |
| 61 | "Connection failed to the host " + |
| 62 | self.user_name + |
| 63 | "@" + |
| 64 | self.ip_address ) |
| 65 | return main.FALSE |
| 66 | |
| 67 | def addFlow( self, **flowParameters ): |
| 68 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 69 | addFlow create a new flow entry into flow table using "dpctl" |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 70 | """ |
| 71 | args = utilities.parse_args( [ |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 72 | "TCPIP", |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 73 | "TCPPORT", |
| 74 | "INPORT", |
| 75 | "ACTION", |
| 76 | "TIMEOUT" ], |
Jeremy Ronquillo | 8270549 | 2017-10-18 14:19:55 -0700 | [diff] [blame] | 77 | **flowParameters ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 78 | |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 79 | cmd = "dpctl add-flow tcp:" |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 80 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 81 | tcpPort = args[ "TCPPORT" ] if args[ |
| 82 | "TCPPORT" ] is not None else "6634" |
| 83 | timeOut = args[ "TIMEOUT" ] if args[ "TIMEOUT" ] is not None else 120 |
| 84 | cmd = cmd + tcpIP + ":" + tcpPort + " in_port=" + \ |
| 85 | str( args[ "INPORT" ] ) + ",idle_timeout=" + str( |
| 86 | args[ "TIMEOUT" ] ) + ",actions=" + args[ "ACTION" ] |
Devin Lim | dc78e20 | 2017-06-09 18:30:07 -0700 | [diff] [blame] | 87 | response = self.execute( cmd=cmd, prompt="\~" + self.prompt, timeout=60 ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 88 | if utilities.assert_matches( expect="openflow", actual=response, onpass="Flow Added Successfully", onfail="Adding Flow Failed!!!" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 89 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 90 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 91 | return main.FALSE |
| 92 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 93 | def showFlow( self, **flowParameters ): |
| 94 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 95 | showFlow dumps the flow entries of flow table using "dpctl" |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 96 | """ |
| 97 | args = utilities.parse_args( [ "TCPIP", "TCPPORT" ], **flowParameters ) |
| 98 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 99 | tcpPort = args[ "TCPPORT" ] if args[ |
| 100 | "TCPPORT" ] is not None else "6634" |
| 101 | command = "dpctl show tcp:" + str( tcpIP ) + ":" + str( tcpPort ) |
| 102 | response = self.execute( |
| 103 | cmd=command, |
| 104 | prompt="get_config_reply", |
| 105 | timeout=240 ) |
| 106 | if utilities.assert_matches( expect='features_reply', actual=response, onpass="Show flow executed", onfail="Show flow execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 107 | main.last_result = main.TRUE |
| 108 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 109 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 110 | main.last_result = main.FALSE |
| 111 | return main.FALSE |
| 112 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 113 | def dumpFlow( self, **flowParameters ): |
| 114 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 115 | dumpFlow gives installed flow information |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 116 | """ |
| 117 | args = utilities.parse_args( [ "TCPIP", "TCPPORT" ], **flowParameters ) |
| 118 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 119 | tcpPort = args[ "TCPPORT" ] if args[ |
| 120 | "TCPPORT" ] is not None else "6634" |
| 121 | command = "dpctl dump-flows tcp:" + str( tcpIP ) + ":" + str( tcpPort ) |
| 122 | response = self.execute( cmd=command, prompt="type=", timeout=240 ) |
| 123 | if utilities.assert_matches( expect='stats_reply', actual=response, onpass="Dump flow executed", onfail="Dump flow execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 124 | main.last_result = main.TRUE |
| 125 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 126 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 127 | main.last_result = main.FALSE |
| 128 | return main.FALSE |
| 129 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 130 | def dumpTables( self, **flowParameters ): |
| 131 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 132 | dumpTables gives statistics for each of the flow tables used by datapath switch. |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 133 | """ |
| 134 | args = utilities.parse_args( [ "TCPIP", "TCPPORT" ], **flowParameters ) |
| 135 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 136 | tcpPort = args[ "TCPPORT" ] if args[ |
| 137 | "TCPPORT" ] is not None else "6634" |
| 138 | command = "dpctl dump-tables tcp:" + \ |
| 139 | str( tcpIP ) + ":" + str( tcpPort ) |
| 140 | response = self.execute( cmd=command, prompt="matched", timeout=240 ) |
| 141 | if utilities.assert_matches( expect='lookup=3', actual=response, onpass="Dump Tables executed", onfail="Dump Tables execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 142 | main.last_result = main.TRUE |
| 143 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 144 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 145 | main.last_result = main.FALSE |
| 146 | return main.FALSE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 147 | |
| 148 | def dumpPorts( self, **flowParameters ): |
| 149 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 150 | dumpPorts gives ports information |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 151 | """ |
| 152 | args = utilities.parse_args( [ "TCPIP", "TCPPORT" ], **flowParameters ) |
| 153 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 154 | tcpPort = args[ "TCPPORT" ] if args[ |
| 155 | "TCPPORT" ] is not None else "6634" |
| 156 | command = "dpctl dump-ports tcp:" + str( tcpIP ) + ":" + str( tcpPort ) |
| 157 | response = self.execute( cmd=command, prompt="rx pkts", timeout=240 ) |
| 158 | if utilities.assert_matches( expect='ports', actual=response, onpass="Dump Ports executed", onfail="Dump Ports execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 159 | main.last_result = main.TRUE |
| 160 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 161 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 162 | main.last_result = main.FALSE |
| 163 | return main.FALSE |
| 164 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 165 | def dumpAggregate( self, **flowParameters ): |
| 166 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 167 | dumpAggregate gives installed flow information.ggregate statistics for flows in datapath WITCH's tables that match flows. |
| 168 | If flows is omitted, the statistics are aggregated across all flows in the datapath's flow tables |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 169 | """ |
| 170 | args = utilities.parse_args( |
| 171 | [ "TCPIP", "TCPPORT", "FLOW" ], **flowParameters ) |
| 172 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 173 | tcpPort = args[ "TCPPORT" ] if args[ |
| 174 | "TCPPORT" ] is not None else "6634" |
| 175 | flow = args[ "FLOW" ] if args[ "FLOW" ] is not None else "" |
| 176 | command = "dpctl dump-aggregate tcp:" + \ |
| 177 | str( tcpIP ) + ":" + str( tcpPort ) + " " + str( flow ) |
| 178 | response = self.execute( |
| 179 | cmd=command, |
| 180 | prompt="flow_count=", |
| 181 | timeout=240 ) |
| 182 | if utilities.assert_matches( expect='stats_reply', actual=response, onpass="Dump Aggregate executed", onfail="Dump Aggregate execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 183 | main.last_result = main.TRUE |
| 184 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 185 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 186 | main.last_result = main.FALSE |
| 187 | return main.FALSE |
| 188 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 189 | def delFlow( self, **flowParameters ): |
| 190 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 191 | delFlow Deletes entries from the datapath switch's tables that match flow |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 192 | """ |
| 193 | args = utilities.parse_args( |
| 194 | [ "TCPIP", "TCPPORT", "FLOW" ], **flowParameters ) |
| 195 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 196 | tcpPort = args[ "TCPPORT" ] if args[ |
| 197 | "TCPPORT" ] is not None else "6634" |
| 198 | flow = args[ "FLOW" ] if args[ "FLOW" ] is not None else "" |
| 199 | command = "dpctl del-flows tcp:" + \ |
| 200 | str( tcpIP ) + ":" + str( tcpPort ) + " " + str( flow ) |
| 201 | response = self.execute( |
| 202 | cmd=command, |
| 203 | prompt="ETH-Tutorial", |
| 204 | timeout=240 ) |
| 205 | if utilities.assert_matches( expect='@', actual=response, onpass="Delete flow executed", onfail="Delete flow execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 206 | main.last_result = main.TRUE |
| 207 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 208 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 209 | main.last_result = main.FALSE |
| 210 | return main.FALSE |
| 211 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 212 | def show( self, **flowParameters ): |
| 213 | """ |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 214 | show gives information on datapath switch including information on its flow tables and ports. |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 215 | """ |
| 216 | args = utilities.parse_args( [ "TCPIP", "TCPPORT" ], **flowParameters ) |
| 217 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 218 | tcpPort = args[ "TCPPORT" ] if args[ |
| 219 | "TCPPORT" ] is not None else "6634" |
| 220 | command = "dpctl show tcp:" + str( tcpIP ) + ":" + str( tcpPort ) |
| 221 | response = self.execute( |
| 222 | cmd=command, |
| 223 | prompt="miss_send_len=", |
| 224 | timeout=240 ) |
| 225 | if utilities.assert_matches( expect='get_config_reply', actual=response, onpass="show command executed", onfail="show command execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 226 | main.last_result = main.TRUE |
| 227 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 228 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 229 | main.last_result = main.FALSE |
| 230 | return main.FALSE |
| 231 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 232 | def showStatus( self, **flowParameters ): |
| 233 | """ |
| 234 | showStatus gives a series of key-value pairs that report the status of switch. |
| 235 | If key is specified, only the key-value pairs whose key names begin with key are printed. |
| 236 | """ |
| 237 | args = utilities.parse_args( |
| 238 | [ "TCPIP", "TCPPORT", "KEY" ], **flowParameters ) |
| 239 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 240 | tcpPort = args[ "TCPPORT" ] if args[ |
| 241 | "TCPPORT" ] is not None else "6634" |
| 242 | key = args[ "KEY" ] if args[ "KEY" ] is not None else "" |
| 243 | command = "dpctl status tcp:" + \ |
| 244 | str( tcpIP ) + ":" + str( tcpPort ) + " " + key |
| 245 | response = self.execute( cmd=command, prompt="(.*)", timeout=240 ) |
| 246 | if utilities.assert_matches( expect='(.*)', actual=response, onpass="show command executed", onfail="show command execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 247 | main.last_result = main.TRUE |
| 248 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 249 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 250 | main.last_result = main.FALSE |
| 251 | return main.FALSE |
| 252 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 253 | def desc_set( self, **flowParameters ): |
| 254 | """ |
| 255 | desc_set Sets the switch description ( as returned in ofp_desc_stats ) to string ( max length is DESC_STR_LEN ) |
| 256 | """ |
| 257 | args = utilities.parse_args( [ |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 258 | "TCPIP", |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 259 | "TCPPORT", |
| 260 | "STRING" ], |
Jeremy Ronquillo | 8270549 | 2017-10-18 14:19:55 -0700 | [diff] [blame] | 261 | **flowParameters ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 262 | |
| 263 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 264 | tcpPort = args[ "TCPPORT" ] if args[ |
| 265 | "TCPPORT" ] is not None else "6634" |
| 266 | string = " " + args[ "STRING" ] if args[ |
| 267 | "STRING" ] is not None else " DESC_STR_LEN" |
| 268 | command = "dpctl desc tcp:" + \ |
| 269 | str( tcpIP ) + ":" + str( tcpPort ) + str( string ) |
| 270 | response = self.execute( |
| 271 | cmd=command, |
| 272 | prompt="ETH-Tutorial", |
| 273 | timeout=240 ) |
| 274 | if utilities.assert_matches( expect='@', actual=response, onpass="desc command executed", onfail="desc command execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 275 | main.last_result = main.TRUE |
| 276 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 277 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 278 | main.last_result = main.FALSE |
| 279 | return main.FALSE |
| 280 | |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 281 | def dumpDesc( self, **flowParameters ): |
| 282 | """ |
| 283 | dumpDesc Sets the switch description ( as returned in ofp_desc_stats ) to string ( max length is DESC_STR_LEN ) |
| 284 | """ |
| 285 | args = utilities.parse_args( [ |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 286 | "TCPIP", |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 287 | "TCPPORT", |
| 288 | "STRING" ], |
Jeremy Ronquillo | 8270549 | 2017-10-18 14:19:55 -0700 | [diff] [blame] | 289 | **flowParameters ) |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 290 | |
| 291 | tcpIP = args[ "TCPIP" ] if args[ "TCPIP" ] is not None else "127.0.0.1" |
| 292 | tcpPort = args[ "TCPPORT" ] if args[ |
| 293 | "TCPPORT" ] is not None else "6634" |
| 294 | command = "dpctl dump-desc tcp:" + str( tcpIP ) + ":" + str( tcpPort ) |
| 295 | response = self.execute( |
| 296 | cmd=command, |
| 297 | prompt="Serial Num:", |
| 298 | timeout=240 ) |
| 299 | if utilities.assert_matches( expect='stats_reply', actual=response, onpass="desc command executed", onfail="desc command execution Failed" ): |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 300 | main.last_result = main.TRUE |
| 301 | return main.TRUE |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 302 | else: |
admin | bae64d8 | 2013-08-01 10:50:15 -0700 | [diff] [blame] | 303 | main.last_result = main.FALSE |
| 304 | return main.FALSE |
| 305 | |
| 306 | if __name__ != "__main__": |
| 307 | import sys |
kelvin | 8ec7144 | 2015-01-15 16:57:00 -0800 | [diff] [blame] | 308 | sys.modules[ __name__ ] = DpctlCliDriver() |