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 | LINK_SHOW_COMMAND_DESCRIPTION = { |
| 18 | 'name' : 'show', |
| 19 | 'obj-type' : 'link', |
| 20 | 'short-help' : 'Show links, controller managed switch to switch interfaces', |
| 21 | 'doc' : 'show-link', |
| 22 | 'doc-example' : 'show-link-example', |
| 23 | 'mode' : 'login', |
| 24 | 'command-type' : 'display-rest', |
| 25 | 'url' : 'links', |
| 26 | 'action' : ( |
| 27 | { |
| 28 | 'proc' : 'query-rest', |
| 29 | }, |
| 30 | { |
| 31 | 'proc' : 'display', |
| 32 | 'sort' : [ 'src-switch', 'src-port' ], |
| 33 | 'format' : 'links', |
| 34 | }, |
| 35 | ), |
| 36 | 'args' : ( |
| 37 | 'link', |
| 38 | #{ |
| 39 | #'field' : 'id', |
| 40 | #'optional' : True, |
| 41 | #'type' : 'obj-type', |
| 42 | #'completion' : 'complete-object-field', |
| 43 | #}, |
| 44 | # These parameters may be re-introduced if the |
| 45 | # underlying rest api provides some search parameters |
| 46 | #{ |
| 47 | #'field' : 'src-switch', |
| 48 | #'tag' : 'src-switch', |
| 49 | #'optional' : True, |
| 50 | #'type' : 'string', |
| 51 | #'completion' : 'complete-object-field', |
| 52 | #}, |
| 53 | #{ |
| 54 | #'field' : 'dst-switch', |
| 55 | #'tag' : 'dst-switch', |
| 56 | #'optional' : True, |
| 57 | #'type' : 'string', |
| 58 | #'completion' : 'complete-object-field', |
| 59 | #} |
| 60 | ) |
| 61 | } |
| 62 | |
| 63 | import fmtcnv |
| 64 | |
| 65 | |
| 66 | LINKS_FORMAT = { |
| 67 | 'links' : { |
| 68 | 'field-orderings' : { |
| 69 | 'default' : [ 'Idx', |
| 70 | 'src-switch', 'src-port', |
| 71 | 'dst-switch', 'dst-port', 'type' ] |
| 72 | }, |
| 73 | 'fields' : { |
| 74 | 'src-switch' : { |
| 75 | 'verbose-name' : 'Src Switch DPID', |
| 76 | 'formatter' : fmtcnv.replace_switch_with_alias |
| 77 | # 'formatter' : fmtcnv.print_switch_and_alias |
| 78 | }, |
| 79 | 'src-port' : { |
| 80 | 'verbose-name' : 'Src Port', |
| 81 | 'formatter' : fmtcnv.decode_openflow_port_src_switch |
| 82 | }, |
| 83 | 'src-port-state' : { |
| 84 | 'verbose-name' : 'Src Port State', |
| 85 | 'formatter' : fmtcnv.decode_port_state |
| 86 | }, |
| 87 | 'dst-switch' : { |
| 88 | 'verbose-name' : 'Dst Switch DPID', |
| 89 | 'formatter' : fmtcnv.replace_switch_with_alias |
| 90 | # 'formatter' : fmtcnv.print_switch_and_alias |
| 91 | }, |
| 92 | 'dst-port' : { |
| 93 | 'verbose-name' : 'Dst Port', |
| 94 | 'formatter' : fmtcnv.decode_openflow_port_dst_switch |
| 95 | }, |
| 96 | 'dst-port-state' : { |
| 97 | 'verbose-name' : 'Dst Port State', |
| 98 | 'formatter' : fmtcnv.decode_port_state |
| 99 | }, |
| 100 | 'link-type' : { |
| 101 | 'verbose-name' : 'Link Type', |
| 102 | }, |
| 103 | } |
| 104 | }, |
| 105 | } |