def parse_args(): parser = argparse.ArgumentParser() _help = ('Path to ofagent.yml config file (default: %s). ' 'If relative, it is relative to main.py of ofagent.' % defs['config']) parser.add_argument('-c', '--config', dest='config', action='store', default=defs['config'], help=_help) _help = '<hostname>:<port> to consul agent (default: %s)' % defs['consul'] parser.add_argument('-C', '--consul', dest='consul', action='store', default=defs['consul'], help=_help) _help = '<hostname1>:<port1> <hostname2>:<port2> <hostname3>:<port3> ... <hostnamen>:<portn> to openflow controller (default: %s)' % \ defs['controller'] parser.add_argument('-O', '--controller', nargs='*', dest='controller', action='store', default=defs['controller'], help=_help) _help = ('<hostname> or <ip> at which ofagent is reachable from outside ' 'the cluster (default: %s)' % defs['external_host_address']) parser.add_argument('-E', '--external-host-address', dest='external_host_address', action='store', default=defs['external_host_address'], help=_help) _help = ('gRPC end-point to connect to. It can either be a direct ' 'definition in the form of <hostname>:<port>, or it can be an ' 'indirect definition in the form of @<service-name> where ' '<service-name> is the name of the grpc service as registered ' 'in consul (example: @voltha-grpc). (default: %s)' % defs['grpc_endpoint']) parser.add_argument('-G', '--grpc-endpoint', dest='grpc_endpoint', action='store', default=defs['grpc_endpoint'], help=_help) _help = 'gRPC timeout in seconds (default: %s)' % defs['grpc_timeout'] parser.add_argument('-T', '--grpc-timeout', dest='grpc_timeout', action='store', default=defs['grpc_timeout'], help=_help) _help = ('The name of the meta-key whose value is the rw-core group ' 'to which the ofagent\'s gRPC client is bound. ' '(default: %s)' % defs['core_binding_key']) parser.add_argument('-B', '--core-binding-key', dest='core_binding_key', action='store', default=defs['core_binding_key'], help=_help) _help = ('The name of the meta-key whose value is the transaction ID ' 'used by the OFAgent to send requests to the Voltha RW Core. ' '(default: %s)' % defs['core_transaction_key']) parser.add_argument('-ctk', '--core_transaction_key', dest='core_transaction_key', action='store', default=defs['core_transaction_key'], help=_help) _help = ('<hostname> or <ip> at which ofagent is reachable from inside ' 'the cluster (default: %s)' % defs['internal_host_address']) parser.add_argument('-H', '--internal-host-address', dest='internal_host_address', action='store', default=defs['internal_host_address'], help=_help) _help = ('unique string id of this ofagent instance (default: %s)' % defs['instance_id']) parser.add_argument('-i', '--instance-id', dest='instance_id', action='store', default=defs['instance_id'], help=_help) _help = 'omit startup banner log lines' parser.add_argument('-n', '--no-banner', dest='no_banner', action='store_true', default=False, help=_help) _help = "suppress debug and info logs" parser.add_argument('-q', '--quiet', dest='quiet', action='count', help=_help) _help = 'enable verbose logging' parser.add_argument('-v', '--verbose', dest='verbose', action='count', help=_help) _help = ('work dir to compile and assemble generated files (default=%s)' % defs['work_dir']) parser.add_argument('-w', '--work-dir', dest='work_dir', action='store', default=defs['work_dir'], help=_help) _help = ('use docker container name as ofagent instance id' ' (overrides -i/--instance-id option)') parser.add_argument('--instance-id-is-container-name', dest='instance_id_is_container_name', action='store_true', default=False, help=_help) _help = ('Specify this option to enable TLS security between ofagent \ and onos.') parser.add_argument('-t', '--enable-tls', dest='enable_tls', action='store_true', help=_help) _help = ('key file to be used for tls security (default=%s)' % defs['key_file']) parser.add_argument('-k', '--key-file', dest='key_file', action='store', default=defs['key_file'], help=_help) _help = ('certificate file to be used for tls security (default=%s)' % defs['cert_file']) parser.add_argument('-r', '--cert-file', dest='cert_file', action='store', default=defs['cert_file'], help=_help) args = parser.parse_args() # post-processing if args.instance_id_is_container_name: args.instance_id = get_my_containers_name() return args
def parse_args(): parser = argparse.ArgumentParser() _help = ('Path to ponsim_onu.yml config file (default: %s). ' 'If relative, it is relative to main.py of ponsim adapter.' % defs['config']) parser.add_argument('-c', '--config', dest='config', action='store', default=defs['config'], help=_help) _help = 'Regular expression for extracting conatiner number from ' \ 'container name (default: %s)' % defs['container_name_regex'] parser.add_argument('-X', '--container-number-extractor', dest='container_name_regex', action='store', default=defs['container_name_regex'], help=_help) _help = '<hostname>:<port> to consul agent (default: %s)' % defs['consul'] parser.add_argument('-C', '--consul', dest='consul', action='store', default=defs['consul'], help=_help) _help = 'name of this adapter (default: %s)' % defs['name'] parser.add_argument('-na', '--name', dest='name', action='store', default=defs['name'], help=_help) _help = 'vendor of this adapter (default: %s)' % defs['vendor'] parser.add_argument('-ven', '--vendor', dest='vendor', action='store', default=defs['vendor'], help=_help) _help = 'supported device type of this adapter (default: %s)' % defs[ 'device_type'] parser.add_argument('-dt', '--device_type', dest='device_type', action='store', default=defs['device_type'], help=_help) _help = 'specifies whether the device type accepts bulk flow updates ' \ 'adapter (default: %s)' % defs['accept_bulk_flow'] parser.add_argument('-abf', '--accept_bulk_flow', dest='accept_bulk_flow', action='store', default=defs['accept_bulk_flow'], help=_help) _help = 'specifies whether the device type accepts add/remove flow ' \ '(default: %s)' % defs['accept_atomic_flow'] parser.add_argument('-aaf', '--accept_atomic_flow', dest='accept_atomic_flow', action='store', default=defs['accept_atomic_flow'], help=_help) _help = '<hostname>:<port> to etcd server (default: %s)' % defs['etcd'] parser.add_argument('-e', '--etcd', dest='etcd', action='store', default=defs['etcd'], help=_help) _help = ('unique string id of this container instance (default: %s)' % defs['instance_id']) parser.add_argument('-i', '--instance-id', dest='instance_id', action='store', default=defs['instance_id'], help=_help) _help = 'ETH interface to recieve (default: %s)' % defs['interface'] parser.add_argument('-I', '--interface', dest='interface', action='store', default=defs['interface'], help=_help) _help = 'omit startup banner log lines' parser.add_argument('-n', '--no-banner', dest='no_banner', action='store_true', default=False, help=_help) _help = 'do not emit periodic heartbeat log messages' parser.add_argument('-N', '--no-heartbeat', dest='no_heartbeat', action='store_true', default=False, help=_help) _help = "suppress debug and info logs" parser.add_argument('-q', '--quiet', dest='quiet', action='count', help=_help) _help = 'enable verbose logging' parser.add_argument('-v', '--verbose', dest='verbose', action='count', help=_help) _help = ('use docker container name as conatiner instance id' ' (overrides -i/--instance-id option)') parser.add_argument('--instance-id-is-container-name', dest='instance_id_is_container_name', action='store_true', default=False, help=_help) _help = ('<hostname>:<port> of the kafka adapter broker (default: %s). (' 'If not ' 'specified (None), the address from the config file is used' % defs['kafka_adapter']) parser.add_argument('-KA', '--kafka_adapter', dest='kafka_adapter', action='store', default=defs['kafka_adapter'], help=_help) _help = ('<hostname>:<port> of the kafka cluster broker (default: %s). (' 'If not ' 'specified (None), the address from the config file is used' % defs['kafka_cluster']) parser.add_argument('-KC', '--kafka_cluster', dest='kafka_cluster', action='store', default=defs['kafka_cluster'], help=_help) _help = 'backend to use for config persitence' parser.add_argument('-b', '--backend', default=defs['backend'], choices=['none', 'consul', 'etcd'], help=_help) _help = 'topic of core on the kafka bus' parser.add_argument('-ct', '--core_topic', dest='core_topic', action='store', default=defs['core_topic'], help=_help) args = parser.parse_args() # post-processing if args.instance_id_is_container_name: args.instance_id = get_my_containers_name() return args
def parse_args(): parser = argparse.ArgumentParser() _help = ('Path to openonu.yml config file (default: %s). ' 'If relative, it is relative to main.py of openonu adapter.' % defs['config']) parser.add_argument('-c', '--config', dest='config', action='store', default=defs['config'], help=_help) _help = 'Regular expression for extracting conatiner number from ' \ 'container name (default: %s)' % defs['container_name_regex'] parser.add_argument('-X', '--container-number-extractor', dest='container_name_regex', action='store', default=defs['container_name_regex'], help=_help) _help = '<hostname>:<port> to consul agent (default: %s)' % defs['consul'] parser.add_argument('-C', '--consul', dest='consul', action='store', default=defs['consul'], help=_help) # NOTE this is really the adapter type _help = 'name of this adapter (default: %s)' % defs['name'] parser.add_argument('-na', '--name', dest='name', action='store', default=defs['name'], help=_help) _help = 'vendor of this adapter (default: %s)' % defs['vendor'] parser.add_argument('-ven', '--vendor', dest='vendor', action='store', default=defs['vendor'], help=_help) _help = 'supported device type of this adapter (default: %s)' % defs[ 'device_type'] parser.add_argument('-dt', '--device_type', dest='device_type', action='store', default=defs['device_type'], help=_help) _help = 'specifies whether the device type accepts bulk flow updates ' \ 'adapter (default: %s)' % defs['accept_bulk_flow'] parser.add_argument('-abf', '--accept_bulk_flow', dest='accept_bulk_flow', action='store', default=defs['accept_bulk_flow'], help=_help) _help = 'specifies whether the device type accepts add/remove flow ' \ '(default: %s)' % defs['accept_atomic_flow'] parser.add_argument('-aaf', '--accept_atomic_flow', dest='accept_atomic_flow', action='store', default=defs['accept_atomic_flow'], help=_help) _help = 'specifies whether the adapter accepts incremental EVTO updates ' \ '(default: %s)' % defs['accept_incremental_evto_update'] parser.add_argument('-aie', '--accept_incremental_evto_update', type=str2bool, dest='accept_incremental_evto_update', action='store', default=defs['accept_incremental_evto_update'], help=_help) _help = '<hostname>:<port> to etcd server (default: %s)' % defs['etcd'] parser.add_argument('-e', '--etcd', dest='etcd', action='store', default=defs['etcd'], help=_help) _help = ('unique string id of this container instance (default: %s)' % defs['instance_id']) parser.add_argument('-i', '--instance-id', dest='instance_id', action='store', default=defs['instance_id'], help=_help) _help = 'ETH interface to recieve (default: %s)' % defs['interface'] parser.add_argument('-I', '--interface', dest='interface', action='store', default=defs['interface'], help=_help) _help = 'omit startup banner log lines' parser.add_argument('-n', '--no-banner', dest='no_banner', action='store_true', default=False, help=_help) _help = 'do not emit periodic heartbeat log messages' parser.add_argument('-N', '--no-heartbeat', dest='no_heartbeat', action='store_true', default=False, help=_help) _help = 'enable logging' parser.add_argument('-l', '--log_level', dest='log_level', action='store', default=defs['log_level'], help=_help) _help = 'get the component name' parser.add_argument('-cn', '--component_name', dest='env', action='store', help=_help) _help = ('use docker container name as conatiner instance id' ' (overrides -i/--instance-id option)') parser.add_argument('--instance-id-is-container-name', dest='instance_id_is_container_name', action='store_true', default=False, help=_help) _help = ('<hostname>:<port> of the kafka adapter broker (default: %s). (' 'If not ' 'specified (None), the address from the config file is used' % defs['kafka_adapter']) parser.add_argument('-KA', '--kafka_adapter', dest='kafka_adapter', action='store', default=defs['kafka_adapter'], help=_help) _help = ('<hostname>:<port> of the kafka cluster broker (default: %s). (' 'If not ' 'specified (None), the address from the config file is used' % defs['kafka_cluster']) parser.add_argument('-KC', '--kafka_cluster', dest='kafka_cluster', action='store', default=defs['kafka_cluster'], help=_help) _help = 'backend to use for config persitence' parser.add_argument('-b', '--backend', default=defs['backend'], choices=['none', 'consul', 'etcd'], help=_help) _help = 'topic of core on the kafka bus' parser.add_argument('-ct', '--core_topic', dest='core_topic', action='store', default=defs['core_topic'], help=_help) _help = 'topic of openolt adapter on the kafka bus' parser.add_argument('-at', '--adapter_topic', dest='adapter_topic', action='store', default=defs['adapter_topic'], help=_help) _help = 'topic of events on the kafka bus' parser.add_argument('-et', '--event_topic', dest='event_topic', action='store', default=defs['event_topic'], help=_help) _help = '<hostname>:<port> for liveness and readiness probes (default: %s)' % defs['probe'] parser.add_argument( '-P', '--probe', dest='probe', action='store', default=defs['probe'], help=_help) _help = 'Replica number of this particular instance (default: %s)' % defs['current_replica'] parser.add_argument( '--currentReplica', dest='current_replica', action='store', default=defs['current_replica'], type=int, help=_help) _help = 'Total number of instances for this adapter (default: %s)' % defs['total_replicas'] parser.add_argument( '--totalReplicas', dest='total_replicas', action='store', default=defs['total_replicas'], type=int, help=_help) args = parser.parse_args() # post-processing if args.instance_id_is_container_name: args.instance_id = get_my_containers_name() return args