Changeset 215
- Timestamp:
- 08/16/12 23:22:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
etherws/trunk/etherws.py
r214 r215 1010 1010 1011 1011 # - sw 1012 parser_sw = subcommand.add_parser('sw') 1013 1014 parser_sw.add_argument('--debug', action='store_true', default=False) 1015 parser_sw.add_argument('--foreground', action='store_true', default=False) 1016 parser_sw.add_argument('--ageout', type=int, default=300) 1017 1018 parser_sw.add_argument('--path', default='/') 1019 parser_sw.add_argument('--host', default='') 1020 parser_sw.add_argument('--port', type=int) 1021 parser_sw.add_argument('--htpasswd') 1022 parser_sw.add_argument('--sslkey') 1023 parser_sw.add_argument('--sslcert') 1024 1025 parser_sw.add_argument('--ctlpath', default='/ctl') 1026 parser_sw.add_argument('--ctlhost', default='127.0.0.1') 1027 parser_sw.add_argument('--ctlport', type=int, default=7867) 1028 parser_sw.add_argument('--ctlhtpasswd') 1029 parser_sw.add_argument('--ctlsslkey') 1030 parser_sw.add_argument('--ctlsslcert') 1012 parser_sw = subcommand.add_parser('sw', 1013 help='start virtual switch') 1014 1015 parser_sw.add_argument('--debug', action='store_true', default=False, 1016 help='run as debug mode') 1017 parser_sw.add_argument('--foreground', action='store_true', default=False, 1018 help='run as foreground mode') 1019 parser_sw.add_argument('--ageout', type=int, default=300, 1020 help='FDB ageout time (sec)') 1021 1022 parser_sw.add_argument('--path', default='/', 1023 help='http(s) path to serve WebSocket') 1024 parser_sw.add_argument('--host', default='', 1025 help='listen address to serve WebSocket') 1026 parser_sw.add_argument('--port', type=int, 1027 help='listen port to serve WebSocket') 1028 parser_sw.add_argument('--htpasswd', 1029 help='path to htpasswd file to auth WebSocket') 1030 parser_sw.add_argument('--sslkey', 1031 help='path to SSL private key for WebSocket') 1032 parser_sw.add_argument('--sslcert', 1033 help='path to SSL certificate for WebSocket') 1034 1035 parser_sw.add_argument('--ctlpath', default='/ctl', 1036 help='http(s) path to serve control API') 1037 parser_sw.add_argument('--ctlhost', default='127.0.0.1', 1038 help='listen address to serve control API') 1039 parser_sw.add_argument('--ctlport', type=int, default=7867, 1040 help='listen port to serve control API') 1041 parser_sw.add_argument('--ctlhtpasswd', 1042 help='path to htpasswd file to auth control API') 1043 parser_sw.add_argument('--ctlsslkey', 1044 help='path to SSL private key for control API') 1045 parser_sw.add_argument('--ctlsslcert', 1046 help='path to SSL certificate for control API') 1031 1047 1032 1048 # - ctl 1033 parser_ctl = subcommand.add_parser('ctl') 1034 parser_ctl.add_argument('--ctlurl', default='http://127.0.0.1:7867/ctl') 1035 parser_ctl.add_argument('--ctluser') 1036 parser_ctl.add_argument('--ctlpasswd') 1049 parser_ctl = subcommand.add_parser('ctl', 1050 help='control virtual switch') 1051 parser_ctl.add_argument('--ctlurl', default='http://127.0.0.1:7867/ctl', 1052 help='URL to control API') 1053 parser_ctl.add_argument('--ctluser', 1054 help='username to auth control API') 1055 parser_ctl.add_argument('--ctlpasswd', 1056 help='password to auth control API') 1037 1057 1038 1058 control_method = parser_ctl.add_subparsers(dest='control_method') 1039 1059 1040 1060 # -- ctl addport 1041 parser_ctl_addport = control_method.add_parser('addport') 1061 parser_ctl_addport = control_method.add_parser('addport', 1062 help='create and add port') 1042 1063 iftype = parser_ctl_addport.add_subparsers(dest='iftype') 1043 1064 1044 1065 # --- ctl addport tap 1045 parser_ctl_addport_tap = iftype.add_parser(TapHandler.IFTYPE) 1046 parser_ctl_addport_tap.add_argument('target') 1066 parser_ctl_addport_tap = iftype.add_parser(TapHandler.IFTYPE, 1067 help='TAP device') 1068 parser_ctl_addport_tap.add_argument('target', 1069 help='device name to create interface') 1047 1070 1048 1071 # --- ctl addport client 1049 parser_ctl_addport_client = iftype.add_parser(EtherWebSocketClient.IFTYPE) 1050 parser_ctl_addport_client.add_argument('target') 1051 parser_ctl_addport_client.add_argument('--user') 1052 parser_ctl_addport_client.add_argument('--passwd') 1053 parser_ctl_addport_client.add_argument('--cacerts') 1072 parser_ctl_addport_client = iftype.add_parser(EtherWebSocketClient.IFTYPE, 1073 help='WebSocket client') 1074 parser_ctl_addport_client.add_argument('target', 1075 help='URL to connect WebSocket') 1076 parser_ctl_addport_client.add_argument('--user', 1077 help='username to auth WebSocket') 1078 parser_ctl_addport_client.add_argument('--passwd', 1079 help='password to auth WebSocket') 1080 parser_ctl_addport_client.add_argument('--cacerts', 1081 help='path to CA certificate') 1054 1082 parser_ctl_addport_client.add_argument( 1055 '--insecure', action='store_true', default=False) 1083 '--insecure', action='store_true', default=False, 1084 help='do not verify server certificate') 1056 1085 1057 1086 # -- ctl setport 1058 parser_ctl_setport = control_method.add_parser('setport') 1059 parser_ctl_setport.add_argument('port', type=int) 1060 parser_ctl_setport.add_argument('--shut', type=int, choices=(0, 1)) 1087 parser_ctl_setport = control_method.add_parser('setport', 1088 help='set port config') 1089 parser_ctl_setport.add_argument('port', type=int, 1090 help='port number to set config') 1091 parser_ctl_setport.add_argument('--shut', type=int, choices=(0, 1), 1092 help='set shutdown state') 1061 1093 1062 1094 # -- ctl delport 1063 parser_ctl_delport = control_method.add_parser('delport') 1064 parser_ctl_delport.add_argument('port', type=int) 1095 parser_ctl_delport = control_method.add_parser('delport', 1096 help='delete port') 1097 parser_ctl_delport.add_argument('port', type=int, 1098 help='port number to delete') 1065 1099 1066 1100 # -- ctl listport 1067 parser_ctl_listport = control_method.add_parser('listport') 1101 parser_ctl_listport = control_method.add_parser('listport', 1102 help='show port list') 1068 1103 1069 1104 # -- ctl setif 1070 parser_ctl_setif = control_method.add_parser('setif') 1071 parser_ctl_setif.add_argument('port', type=int) 1072 parser_ctl_setif.add_argument('--address') 1073 parser_ctl_setif.add_argument('--netmask') 1074 parser_ctl_setif.add_argument('--mtu', type=int) 1105 parser_ctl_setif = control_method.add_parser('setif', 1106 help='set interface config') 1107 parser_ctl_setif.add_argument('port', type=int, 1108 help='port number to set config') 1109 parser_ctl_setif.add_argument('--address', 1110 help='IPv4 address to set interface') 1111 parser_ctl_setif.add_argument('--netmask', 1112 help='IPv4 netmask to set interface') 1113 parser_ctl_setif.add_argument('--mtu', type=int, 1114 help='MTU to set interface') 1075 1115 1076 1116 # -- ctl listif 1077 parser_ctl_listif = control_method.add_parser('listif') 1117 parser_ctl_listif = control_method.add_parser('listif', 1118 help='show interface list') 1078 1119 1079 1120 # -- ctl listfdb 1080 parser_ctl_listfdb = control_method.add_parser('listfdb') 1121 parser_ctl_listfdb = control_method.add_parser('listfdb', 1122 help='show FDB entries') 1081 1123 1082 1124 # -- go
Note: See TracChangeset
for help on using the changeset viewer.