Srikanth Vavilapalli | 1725e49 | 2014-12-01 17:50:52 -0800 | [diff] [blame^] | 1 | # |
| 2 | # Copyright (c) 2013 Big Switch Networks, Inc. |
| 3 | # |
| 4 | # Licensed under the Eclipse Public License, Version 1.0 (the |
| 5 | # "License"); you may not use this file except in compliance with the |
| 6 | # License. You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.eclipse.org/legal/epl-v10.html |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. See the License for the specific language governing |
| 14 | # permissions and limitations under the License. |
| 15 | # |
| 16 | """ |
| 17 | HOST_SUBMODE_COMMAND_DESCRIPTION = { |
| 18 | 'name' : 'host', |
| 19 | 'obj-type' : 'host-config', |
| 20 | 'mode' : 'config*', |
| 21 | 'command-type' : 'config-submode', |
| 22 | 'parent-field' : None, |
| 23 | 'current-mode-obj-id' : None, |
| 24 | 'submode-name' : 'config-host', |
| 25 | 'short-help' : 'Host submode, configure host details', |
| 26 | 'doc' : 'host|host', |
| 27 | 'doc-example' : 'host|host-example', |
| 28 | 'data' : { |
| 29 | 'address-space' : 'default', |
| 30 | 'vlan' : '', |
| 31 | }, |
| 32 | 'args' : ( |
| 33 | { |
| 34 | 'field' : 'address-space', |
| 35 | 'tag' : 'address-space', |
| 36 | 'type' : 'string', |
| 37 | 'optional' : True, |
| 38 | 'optional-for-no' : True, |
| 39 | 'completion' : 'complete-from-another', |
| 40 | 'other' : 'address-space', |
| 41 | 'doc' : 'host|host-address-space', |
| 42 | }, |
| 43 | { |
| 44 | 'field' : 'vlan', |
| 45 | 'tag' : 'vlan', |
| 46 | 'type' : 'integer', |
| 47 | 'range' : (0,4095), |
| 48 | 'optional' : True, |
| 49 | 'optional-for-no' : True, |
| 50 | 'doc' : 'host|host-vlan', |
| 51 | }, |
| 52 | { |
| 53 | 'field' : 'mac', |
| 54 | 'type' : 'host', |
| 55 | 'completion' : [ 'complete-alias-choice', |
| 56 | ], |
| 57 | 'other' : 'host', |
| 58 | 'scoped' : True, |
| 59 | 'data-handler' : 'alias-to-value', |
| 60 | } |
| 61 | ) |
| 62 | } |
| 63 | """ |
| 64 | |
| 65 | host_show_mac_action = ( |
| 66 | { |
| 67 | 'proc' : 'query-table', |
| 68 | 'obj-type' : 'host', |
| 69 | }, |
| 70 | { # add any associated tags |
| 71 | 'proc' : 'join-table', |
| 72 | 'obj-type' : 'tag-mapping', |
| 73 | 'key' : 'mac', |
| 74 | 'key-value' : 'tag', # causes list creation for multiple matches |
| 75 | 'join-field' : 'mac', |
| 76 | 'add-field' : 'tag', |
| 77 | }, |
| 78 | { |
| 79 | 'proc' : 'display', |
| 80 | 'format' : 'host', |
| 81 | }, |
| 82 | ) |
| 83 | |
| 84 | |
| 85 | HOST_SHOW_COMMAND_DESCRIPTION = { |
| 86 | 'name' : 'show', |
| 87 | 'mode' : 'login', |
| 88 | 'short-help' : 'Show host summaries', |
| 89 | 'doc' : 'host|show', |
| 90 | 'doc-example' : 'host|show-example', |
| 91 | 'no-supported' : False, |
| 92 | 'command-type' : 'display-table', |
| 93 | 'args' : ( |
| 94 | { |
| 95 | 'token' : 'host', |
| 96 | 'action' : host_show_mac_action, |
| 97 | } |
| 98 | ) |
| 99 | } |
| 100 | |
| 101 | HOST_SHOW_MAC_COMMAND_DESCRIPTION = { |
| 102 | 'name' : 'show', |
| 103 | 'mode' : 'login', |
| 104 | 'short-help' : 'Show host details based on query', |
| 105 | 'doc' : 'host|show-host', |
| 106 | 'doc-example' : 'host|show-host-example', |
| 107 | 'no-supported' : False, |
| 108 | 'command-type' : 'display-table', |
| 109 | 'obj-type' : 'host', |
| 110 | 'action' : host_show_mac_action, |
| 111 | 'args' : ( |
| 112 | 'host', |
| 113 | { |
| 114 | 'choices' : ( |
| 115 | { |
| 116 | 'field' : 'mac', |
| 117 | 'type' : 'host', |
| 118 | 'short-help' : 'Show the hosts with the given MAC or alias', |
| 119 | 'help-name' : 'host mac or alias', |
| 120 | 'completion' : 'complete-alias-choice', |
| 121 | 'data-handler' : 'alias-to-value', |
| 122 | 'doc' : 'host|show-host-mac', |
| 123 | }, |
| 124 | { |
| 125 | 'field' : 'address-space', |
| 126 | 'short-help' : 'Show the hosts with the given IPv4 address', |
| 127 | 'tag' : 'address-space', |
| 128 | 'type' : 'identifier', |
| 129 | 'help-name' : 'address space', |
| 130 | 'completion' : 'complete-object-field', |
| 131 | 'doc' : 'host|show-host-address-space', |
| 132 | }, |
| 133 | { |
| 134 | 'field' : 'ipv4', |
| 135 | 'short-help' : 'Show the hosts with the given IPv4 address', |
| 136 | 'tag' : 'ip-address', |
| 137 | 'type' : 'ip-address', |
| 138 | 'help-name' : 'ip address', |
| 139 | 'completion' : 'complete-object-field', |
| 140 | 'doc' : 'host|show-host-ipv4', |
| 141 | }, |
| 142 | { |
| 143 | 'field' : 'dpid', |
| 144 | 'short-help' : 'Show the hosts attached to the given switch', |
| 145 | 'tag' : 'switch', |
| 146 | 'type' : 'dpid', |
| 147 | 'help-name' : 'switch dpid or alias', |
| 148 | 'completion' : 'complete-object-field', |
| 149 | #'completion' : 'complete-alias-choice', |
| 150 | 'data-handler' : 'alias-to-value', |
| 151 | 'doc' : 'host|show-host-switch', |
| 152 | }, |
| 153 | { |
| 154 | 'field' : 'host', |
| 155 | 'short-help': 'Show all hosts', |
| 156 | 'type' : 'enum', |
| 157 | 'values' : 'all', |
| 158 | 'doc' : 'host|show-host-all', |
| 159 | }, |
| 160 | ) |
| 161 | }, |
| 162 | { |
| 163 | 'optional' : True, |
| 164 | 'choices' : ( |
| 165 | ( |
| 166 | { |
| 167 | 'token' : 'by', |
| 168 | 'short-help' : 'Sort displayed hosts', |
| 169 | 'doc' : 'reserved|by', |
| 170 | }, |
| 171 | { |
| 172 | 'token' : 'last-seen', |
| 173 | 'short-help': 'Sort by the last seen time', |
| 174 | 'sort' : '-last-seen', |
| 175 | 'action' : 'display-table', |
| 176 | 'doc' : 'host|show-host-by-last-seen', |
| 177 | }, |
| 178 | ), |
| 179 | ) |
| 180 | }, |
| 181 | { |
| 182 | 'optional' : True, |
| 183 | 'field' : 'detail', |
| 184 | 'type' : 'enum', |
| 185 | 'short-help' : 'Display either detailed or brief information', |
| 186 | 'values' : ('details','brief'), |
| 187 | 'doc' : 'format|+', |
| 188 | }, |
| 189 | ) |
| 190 | } |
| 191 | |
| 192 | |
| 193 | HOST_SHOW_MAC_ITEMS_COMMAND_DESCRIPTION = { |
| 194 | 'name' : 'show', |
| 195 | 'mode' : 'login', |
| 196 | 'short-help' : 'Show various host related details by query', |
| 197 | 'doc' : 'host|show-host-items', |
| 198 | 'doc-example' : 'host|show-host-items-example', |
| 199 | 'no-supported' : False, |
| 200 | 'command-type' : 'display-table', |
| 201 | 'obj-type' : 'host', |
| 202 | 'args' : ( |
| 203 | 'host', |
| 204 | { |
| 205 | 'choices' : ( |
| 206 | { |
| 207 | 'field' : 'mac', |
| 208 | 'type' : 'host', |
| 209 | 'short-help' : 'Show the hosts with the given MAC or alias', |
| 210 | 'help-name' : 'host mac or alias', |
| 211 | 'completion' : 'complete-alias-choice', |
| 212 | 'data-handler' : 'alias-to-value', |
| 213 | 'doc' : 'host|show-host-mac', |
| 214 | }, |
| 215 | { |
| 216 | 'field' : 'ipv4', |
| 217 | 'tag' : 'ip-address', |
| 218 | 'short-help' : 'Show the hosts with the given IPv4 address', |
| 219 | 'type' : 'ip-address', |
| 220 | 'help-name' : 'ip address', |
| 221 | 'completion' : 'complete-object-field', |
| 222 | 'doc' : 'host|show-host-ipv4', |
| 223 | }, |
| 224 | { |
| 225 | 'field' : 'dpid', |
| 226 | 'short-help' : 'Show the hosts attached to the given switch', |
| 227 | 'tag' : 'switch', |
| 228 | 'type' : 'dpid', |
| 229 | 'help-name' : 'switch dpid or alias', |
| 230 | 'completion' : 'complete-object-field', |
| 231 | #'completion' : 'complete-alias-choice', |
| 232 | 'data-handler' : 'alias-to-value', |
| 233 | 'doc' : 'host|show-host-switch', |
| 234 | }, |
| 235 | { |
| 236 | 'field' : 'host', |
| 237 | 'short-help': 'Show all hosts', |
| 238 | 'type' : 'enum', |
| 239 | 'values' : 'all', |
| 240 | 'doc' : 'host|show-host-all', |
| 241 | }, |
| 242 | ) |
| 243 | }, |
| 244 | { |
| 245 | 'choices' : ( |
| 246 | ( |
| 247 | { |
| 248 | 'field' : 'attachment-point', |
| 249 | 'type' : 'enum', |
| 250 | 'values' : 'attachment-point', |
| 251 | 'obj-type' : 'host-attachment-point', |
| 252 | 'action' : 'display-table', |
| 253 | 'short-help' : 'Show host attachment points', |
| 254 | 'doc' : 'host|show-host-item-attachment-point', |
| 255 | }, |
| 256 | { |
| 257 | 'optional' : True, |
| 258 | 'choices' : ( |
| 259 | ( |
| 260 | { |
| 261 | 'token' : 'by', |
| 262 | 'short-help' : 'Sort displayed hosts', |
| 263 | 'doc' : 'reserved|by', |
| 264 | }, |
| 265 | { |
| 266 | 'choices' : ( |
| 267 | { |
| 268 | 'token' : 'host-last-seen', |
| 269 | 'sort' : 'host,-last-seen', |
| 270 | 'obj-type' : 'host-attachment-point', |
| 271 | 'action' : 'display-table', |
| 272 | 'short-help' : 'Sort by the last seen time for the host', |
| 273 | 'doc' : 'host|show-host-by-host-last-seen', |
| 274 | }, |
| 275 | { |
| 276 | 'token' : 'last-seen', |
| 277 | 'sort' : '-last-seen', |
| 278 | 'obj-type' : 'host-attachment-point', |
| 279 | 'action' : 'display-table', |
| 280 | 'short-help' : 'Sort by the last seen time for the attachment point', |
| 281 | 'doc' : 'host|show-host-by-last-seen', |
| 282 | }, |
| 283 | ), |
| 284 | }, |
| 285 | ), |
| 286 | ), |
| 287 | }, |
| 288 | { |
| 289 | 'field' : 'detail', |
| 290 | 'type' : 'enum', |
| 291 | 'values' : ('details', 'brief'), |
| 292 | 'optional' : True, |
| 293 | 'short-help' : 'Display either detailed or brief information', |
| 294 | 'doc' : 'format|+', |
| 295 | } |
| 296 | ), |
| 297 | ( |
| 298 | { |
| 299 | 'field' : 'network-address', |
| 300 | 'type' : 'enum', |
| 301 | 'values' : 'ip-address', |
| 302 | 'obj-type' : 'host-network-address', |
| 303 | 'action' : 'display-table', |
| 304 | 'doc' : 'host|show-host-item-network-address', |
| 305 | }, |
| 306 | { |
| 307 | 'optional' : True, |
| 308 | 'choices' : ( |
| 309 | ( |
| 310 | {'token': 'by', |
| 311 | 'short-help': 'Sort displayed hosts' |
| 312 | }, |
| 313 | { |
| 314 | |
| 315 | 'choices' : ( |
| 316 | { |
| 317 | 'token' : 'host-last-seen', |
| 318 | 'sort' : 'host,-last-seen', |
| 319 | 'short-help' : 'Sort by the last seen time for the host', |
| 320 | 'obj-type' : 'host-network-address', |
| 321 | 'action' : 'display-table', |
| 322 | 'doc' : 'host|show-host-by-host-last-seen', |
| 323 | }, |
| 324 | { |
| 325 | 'token' : 'last-seen', |
| 326 | 'sort' : '-last-seen', |
| 327 | 'short-help' : 'Sort by the last seen time for the network address', |
| 328 | 'obj-type' : 'host-network-address', |
| 329 | 'action' : 'display-table', |
| 330 | 'doc' : 'host|show-host-by-last-seen', |
| 331 | } |
| 332 | ) |
| 333 | }, |
| 334 | ), |
| 335 | ), |
| 336 | }, |
| 337 | { |
| 338 | 'field' : 'detail', |
| 339 | 'type' : 'enum', |
| 340 | 'values' : ('details', 'brief'), |
| 341 | 'optional' : True, |
| 342 | 'short-help' : 'Display either detailed or brief information', |
| 343 | 'doc' : 'format|+' |
| 344 | } |
| 345 | ), |
| 346 | { |
| 347 | 'field' : 'alias', |
| 348 | 'type' : 'enum', |
| 349 | 'values' : 'alias', |
| 350 | 'obj-type' : 'host-alias', |
| 351 | 'action' : 'display-table', |
| 352 | 'short-help' : 'Display host alias mappings', |
| 353 | 'doc' : 'host|show-host-item-alias', |
| 354 | }, |
| 355 | ), |
| 356 | }, |
| 357 | ) |
| 358 | } |
| 359 | |
| 360 | """ |
| 361 | HOST_HOST_ALIAS_COMMAND_DESCRIPTION = { |
| 362 | 'name' : 'host-alias', |
| 363 | 'mode' : 'config-host', |
| 364 | 'short-help' : 'Attach alias to host', |
| 365 | 'doc' : 'host|host-alias', |
| 366 | 'doc-example' : 'host|host-alias-example', |
| 367 | 'command-type' : 'manage-alias', |
| 368 | 'obj-type' : 'host-alias', |
| 369 | 'scoped' : True, |
| 370 | 'reserved' : [ 'switch', 'ip-address' ], |
| 371 | 'args' : ( |
| 372 | { |
| 373 | 'field' : 'id', |
| 374 | 'base-type' : 'identifier', |
| 375 | 'optional-for-no' : False, |
| 376 | 'completion' : 'complete-object-field', |
| 377 | } |
| 378 | ) |
| 379 | } |
| 380 | |
| 381 | |
| 382 | HOST_SECURITY_POLICY_BIND_IP_ADDRESS_COMMAND_DESCRIPTION = { |
| 383 | 'name' : 'security', |
| 384 | 'mode' : 'config-host', |
| 385 | 'short-help' : 'Configure security policies for host', |
| 386 | 'doc' : 'host|security', |
| 387 | 'doc-example' : 'host|security-example', |
| 388 | 'command-type' : 'config-object', |
| 389 | 'parent-field' : 'host', |
| 390 | 'args' : ( |
| 391 | { |
| 392 | 'token' : 'policy', |
| 393 | 'doc' : 'host|security-policy', |
| 394 | }, |
| 395 | { |
| 396 | 'token' : 'bind', |
| 397 | 'doc' : 'host|security-bind', |
| 398 | }, |
| 399 | { |
| 400 | 'choices' : ( |
| 401 | { |
| 402 | 'field' : 'ip-address', |
| 403 | 'tag' : 'ip-address', |
| 404 | 'base-type' : 'ip-address', |
| 405 | 'optional-for-no' : False, |
| 406 | # could possibly complete all ip-addresses |
| 407 | 'completion' : 'complete-object-field', |
| 408 | 'obj-type' : 'host-security-ip-address', |
| 409 | 'action' : 'write-object', |
| 410 | 'no-action' : 'delete-objects', |
| 411 | 'short-help' : 'restrict host access to ip-address', |
| 412 | 'doc' : 'host|security-ip-address', |
| 413 | }, |
| 414 | ( |
| 415 | { |
| 416 | 'token' : 'attachment-point', |
| 417 | 'short-help' : 'restrict host access to attachment point', |
| 418 | 'doc' : 'host|security-attachment-point', |
| 419 | }, |
| 420 | { |
| 421 | 'choices' : ( |
| 422 | { |
| 423 | 'token' : 'all' |
| 424 | }, |
| 425 | { |
| 426 | 'field' : 'dpid', |
| 427 | 'type' : 'dpid', |
| 428 | 'completion' : [ |
| 429 | 'complete-object-field', |
| 430 | 'complete-alias-choice', |
| 431 | ], |
| 432 | 'obj-type' : 'switches', |
| 433 | 'other' : 'switches|dpid', |
| 434 | 'help-name' : 'switch dpid or alias', |
| 435 | 'data-handler' : 'alias-to-value', |
| 436 | 'optional-for-no' : False, |
| 437 | 'short-help' : 'identify switch for attachment point', |
| 438 | 'doc' : 'host|security-attachment-point-switch', |
| 439 | }, |
| 440 | ) |
| 441 | }, |
| 442 | { |
| 443 | 'field' : 'if-name-regex', |
| 444 | 'optional-for-no' : False, |
| 445 | 'syntax-help' : 'Regular expression match for interfaces', |
| 446 | 'action' : 'write-object', |
| 447 | 'no-action' : 'delete-objects', |
| 448 | 'obj-type' : 'host-security-attachment-point', |
| 449 | 'completion' : [ |
| 450 | 'complete-object-field', |
| 451 | 'complete-from-another', |
| 452 | ], |
| 453 | 'other' : 'interfaces|portName', |
| 454 | 'scoped' : 'switch', |
| 455 | 'short-help' : 'identify interface for attachment point', |
| 456 | 'doc' : 'host|security-attachment-point-interface', |
| 457 | }, |
| 458 | ), |
| 459 | ), |
| 460 | }, |
| 461 | ), |
| 462 | } |
| 463 | """ |
| 464 | |
| 465 | # |
| 466 | # FORMATS |
| 467 | # |
| 468 | |
| 469 | import fmtcnv |
| 470 | |
| 471 | |
| 472 | HOST_FORMAT = { |
| 473 | 'host': { |
| 474 | 'field-orderings' : { |
| 475 | 'default' : [ 'Idx', 'id', |
| 476 | 'ips', 'attachment-points' ], |
| 477 | 'details' : [ 'Idx', 'id', |
| 478 | 'vendor', 'ips', 'attachment-points' |
| 479 | ], |
| 480 | 'brief' : [ 'Idx', 'id', 'ips'], |
| 481 | }, |
| 482 | |
| 483 | |
| 484 | 'fields': { |
| 485 | 'id' : { |
| 486 | 'verbose-name': 'MAC Address', |
| 487 | 'formatter' : fmtcnv.print_host_and_alias, |
| 488 | }, |
| 489 | 'mac' : { |
| 490 | 'verbose-name': 'MAC Address', |
| 491 | 'formatter' : fmtcnv.print_host_and_alias, |
| 492 | }, |
| 493 | 'address-space' : { |
| 494 | 'verbose-name' : 'Address Space', |
| 495 | }, |
| 496 | 'vendor' : { |
| 497 | 'formatter' : fmtcnv.sanitize_unicode, |
| 498 | }, |
| 499 | 'vlan' : { |
| 500 | 'verbose-name': 'VLAN', |
| 501 | 'formatter' : fmtcnv.convert_to_string, |
| 502 | }, |
| 503 | 'ips' : { |
| 504 | 'verbose-name' : 'IP Address', |
| 505 | 'formatter' : fmtcnv.print_ip_addresses, |
| 506 | 'entry-formatter' : fmtcnv.print_all_ip_addresses, |
| 507 | }, |
| 508 | 'attachment-points' : { |
| 509 | 'verbose-name' : 'Switch/OF Port (Physical Port)', |
| 510 | 'formatter' : fmtcnv.print_host_attachment_point, |
| 511 | 'entry-formatter' : fmtcnv.print_all_host_attachment_points, |
| 512 | }, |
| 513 | 'tag' : { |
| 514 | 'formatter' : fmtcnv.print_host_tags, |
| 515 | 'entry-formatter' : fmtcnv.print_all_host_tags, |
| 516 | }, |
| 517 | 'dhcp-client-name' : { |
| 518 | 'verbose-name' : 'DHCP Client Name', |
| 519 | }, |
| 520 | 'last-seen' : { |
| 521 | 'verbose-name': 'Last Seen', |
| 522 | 'formatter' : fmtcnv.print_time_since_utc, |
| 523 | }, |
| 524 | }, |
| 525 | }, |
| 526 | } |
| 527 | |
| 528 | |
| 529 | HOST_ATTACHMENT_POINT_FORMAT = { |
| 530 | 'host-attachment-point' : { |
| 531 | 'field-orderings' : { |
| 532 | 'default' : [ 'Idx', 'mac', 'vlan', 'address-space', 'switch', 'ingress-port', 'status', ], |
| 533 | 'details' : [ 'Idx', 'mac', 'vlan', 'address-space', 'switch', 'ingress-port', 'status', 'last-seen'], |
| 534 | }, |
| 535 | |
| 536 | 'fields': { |
| 537 | 'mac' : { |
| 538 | 'verbose-name' : 'MAC Address', |
| 539 | 'formatter' : fmtcnv.print_host_and_alias, |
| 540 | }, |
| 541 | 'vlan' : { |
| 542 | 'verbose-name': 'VLAN', |
| 543 | 'formatter' : fmtcnv.convert_to_string, |
| 544 | }, |
| 545 | |
| 546 | 'address-space' : { |
| 547 | 'verbose-name' : 'Address Space', |
| 548 | }, |
| 549 | 'switch' : { |
| 550 | 'verbose-name' : 'Switch ID', |
| 551 | 'formatter' : fmtcnv.print_switch_and_alias |
| 552 | }, |
| 553 | 'ingress-port' : { |
| 554 | 'verbose-name': 'Port', |
| 555 | 'formatter' : fmtcnv.decode_openflow_port, |
| 556 | }, |
| 557 | 'status' : { |
| 558 | 'verbose-name': 'Error Status (if any)' |
| 559 | }, |
| 560 | 'last-seen' : { |
| 561 | 'verbose-name': 'Last Seen', |
| 562 | 'formatter' : fmtcnv.timestamp_to_local_timestr, |
| 563 | }, |
| 564 | }, |
| 565 | }, |
| 566 | } |
| 567 | |
| 568 | |
| 569 | HOST_NETWORK_ADDRESS_FORMAT = { |
| 570 | 'host-network-address': { |
| 571 | 'field-orderings' : { |
| 572 | 'default' : [ 'Idx', 'mac', 'address-space', 'vlan', 'ip-address', ], |
| 573 | 'details' : [ 'Idx', 'mac', 'address-space', 'vlan', 'ip-address', 'last-seen' ], |
| 574 | }, |
| 575 | 'fields': { |
| 576 | 'mac' : { |
| 577 | 'verbose-name': 'MAC Address', |
| 578 | }, |
| 579 | 'vlan' : { |
| 580 | 'verbose-name': 'VLAN', |
| 581 | }, |
| 582 | 'address-space' : { |
| 583 | 'verbose-name' : 'Address Space', |
| 584 | }, |
| 585 | 'id' : { |
| 586 | }, |
| 587 | 'ip-address': { |
| 588 | 'verbose-name': 'IP Address', |
| 589 | }, |
| 590 | 'last-seen' : { |
| 591 | 'verbose-name': 'Last Seen', |
| 592 | 'formatter' : fmtcnv.timestamp_to_local_timestr, |
| 593 | }, |
| 594 | }, |
| 595 | }, |
| 596 | } |
| 597 | |
| 598 | |
| 599 | HOST_ALIAS_FORMAT = { |
| 600 | 'host-alias' : { |
| 601 | 'field-orderings' : { |
| 602 | 'default' : [ 'Idx', 'id', 'address-space', 'vlan', 'mac' ] |
| 603 | }, |
| 604 | }, |
| 605 | } |
| 606 | |
| 607 | """ |
| 608 | HOST_CONFIG_FORMAT = { |
| 609 | 'host-config' : { |
| 610 | 'field-orderings' : { |
| 611 | 'default' : [ 'Idx', 'mac', 'vlan', 'vendor', 'ips', |
| 612 | 'attachment-points', 'tag', 'last-seen' ], |
| 613 | 'brief' : [ 'Idx', 'mac', 'vlan', 'ips', 'last-seen'], |
| 614 | }, |
| 615 | 'fields' : { |
| 616 | 'mac' : { |
| 617 | 'verbose-name': 'MAC Address', |
| 618 | 'formatter' : fmtcnv.print_host_and_alias, |
| 619 | }, |
| 620 | 'vendor' : { |
| 621 | 'formatter' : fmtcnv.sanitize_unicode, |
| 622 | }, |
| 623 | 'vlan' : { |
| 624 | 'verbose-name': 'VLAN', |
| 625 | 'formatter' : fmtcnv.convert_to_string, |
| 626 | }, |
| 627 | 'ips' : { |
| 628 | 'verbose-name' : 'IP Address', |
| 629 | 'formatter' : fmtcnv.print_ip_addresses, |
| 630 | 'entry-formatter' : fmtcnv.print_all_ip_addresses, |
| 631 | }, |
| 632 | 'attachment-points' : { |
| 633 | 'verbose-name' : 'Switch/OF Port (Physical Port)', |
| 634 | 'formatter' : fmtcnv.print_host_attachment_point, |
| 635 | 'entry-formatter' : fmtcnv.print_all_host_attachment_points, |
| 636 | }, |
| 637 | 'tag' : { |
| 638 | 'formatter' : fmtcnv.print_host_tags, |
| 639 | 'entry-formatter' : fmtcnv.print_all_host_tags, |
| 640 | }, |
| 641 | 'host-alias' : { |
| 642 | }, |
| 643 | 'last-seen' : { |
| 644 | 'verbose-name': 'Last Seen', |
| 645 | 'formatter' : fmtcnv.print_time_since_utc, |
| 646 | }, |
| 647 | }, |
| 648 | }, |
| 649 | } |
| 650 | """ |