Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 1 | /* |
Joey Armstrong | 11f5a57 | 2024-01-12 19:11:32 -0500 | [diff] [blame] | 2 | * Copyright 2018-2024 Open Networking Foundation (ONF) and the ONF Contributors |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 3 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 7 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 9 | |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 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 implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 15 | */ |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 16 | |
Joey Armstrong | 3f0e242 | 2023-07-05 18:25:41 -0400 | [diff] [blame] | 17 | // Package config provides the Log, kvstore, Kafka configuration |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 18 | package config |
| 19 | |
| 20 | import ( |
| 21 | "flag" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 22 | "os" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 23 | "time" |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 24 | ) |
| 25 | |
| 26 | // Open OLT default constants |
| 27 | const ( |
Abhay Kumar | 9bcfeb2 | 2024-07-12 09:14:25 +0530 | [diff] [blame^] | 28 | KVStoreName = "etcd" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 29 | defaultInstanceid = "openOlt001" |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 30 | defaultKafkaclusteraddress = "127.0.0.1:9092" |
Abhay Kumar | 9bcfeb2 | 2024-07-12 09:14:25 +0530 | [diff] [blame^] | 31 | defaultKvstoretype = KVStoreName |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 32 | defaultKvstoretimeout = 5 * time.Second |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 33 | defaultRPCTimeout = 10 * time.Second |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 34 | defaultPerRPCRetryTimeout = 2 * time.Second |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 35 | defaultKvstoreaddress = "127.0.0.1:2379" // Port: Consul = 8500; Etcd = 2379 |
David Bainbridge | 2b3d488 | 2020-03-17 15:06:39 -0700 | [diff] [blame] | 36 | defaultLoglevel = "WARN" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 37 | defaultBanner = false |
| 38 | defaultDisplayVersionOnly = false |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 39 | defaultEventtopic = "voltha.events" |
| 40 | defaultOnunumber = 1 |
Neha Sharma | 3f221ae | 2020-04-29 19:02:12 +0000 | [diff] [blame] | 41 | defaultProbeAddress = ":8080" |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 42 | defaultLiveProbeInterval = 60 * time.Second |
| 43 | defaultNotLiveProbeInterval = 5 * time.Second // Probe more frequently when not alive |
Girish Gowdra | 495dde4 | 2021-03-17 14:59:56 -0700 | [diff] [blame] | 44 | //defaultHeartbeatCheckInterval is the time in seconds the adapter will keep checking the hardware for heartbeat. |
| 45 | defaultHeartbeatCheckInterval = 15 * time.Second |
| 46 | // defaultHeartbeatFailReportInterval is the time adapter will wait before updating the state to the core. |
| 47 | defaultHeartbeatFailReportInterval = 0 * time.Second |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 48 | defaultGrpcAddress = ":50060" |
| 49 | defaultCoreEndpoint = ":55555" |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 50 | //defaultGrpcTimeoutInterval is the time in seconds a grpc call will wait before returning error. |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 51 | defaultGrpcTimeoutInterval = 2 * time.Second |
| 52 | defaultCurrentReplica = 1 |
| 53 | defaultTotalReplicas = 1 |
| 54 | defaultTraceEnabled = false |
| 55 | defaultTraceAgentAddress = "127.0.0.1:6831" |
| 56 | defaultLogCorrelationEnabled = true |
| 57 | defaultOmccEncryption = false |
| 58 | defaultEnableONUStats = false |
| 59 | defaultEnableGEMStats = false |
| 60 | defaultMinBackoffRetryDelay = 500 * time.Millisecond |
| 61 | defaultMaxBackoffRetryDelay = 10 * time.Second |
| 62 | defaultAdapterEndpoint = "adapter-open-olt" |
| 63 | defaultCheckOnuDevExistenceAtOnuDiscovery = false |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 64 | defaultMaxRetries = 10 |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 65 | ) |
| 66 | |
| 67 | // AdapterFlags represents the set of configurations used by the read-write adaptercore service |
| 68 | type AdapterFlags struct { |
| 69 | // Command line parameters |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 70 | AdapterName string |
| 71 | InstanceID string // NOTE what am I used for? why not cli but only ENV? TODO expose in the chart |
| 72 | KafkaClusterAddress string |
| 73 | KVStoreType string |
| 74 | KVStoreTimeout time.Duration |
| 75 | KVStoreAddress string |
| 76 | RPCTimeout time.Duration |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 77 | PerRPCRetryTimeout time.Duration |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 78 | EventTopic string |
| 79 | LogLevel string |
| 80 | OnuNumber int |
| 81 | Banner bool |
| 82 | DisplayVersionOnly bool |
| 83 | ProbeAddress string |
| 84 | LiveProbeInterval time.Duration |
| 85 | NotLiveProbeInterval time.Duration |
| 86 | HeartbeatCheckInterval time.Duration |
| 87 | HeartbeatFailReportInterval time.Duration |
| 88 | GrpcTimeoutInterval time.Duration |
| 89 | GrpcAddress string |
| 90 | CoreEndpoint string |
| 91 | CurrentReplica int |
| 92 | TotalReplicas int |
| 93 | TraceEnabled bool |
| 94 | TraceAgentAddress string |
| 95 | LogCorrelationEnabled bool |
| 96 | OmccEncryption bool |
| 97 | EnableONUStats bool |
| 98 | EnableGEMStats bool |
| 99 | MinBackoffRetryDelay time.Duration |
| 100 | MaxBackoffRetryDelay time.Duration |
| 101 | AdapterEndpoint string |
| 102 | CheckOnuDevExistenceAtOnuDiscovery bool |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 103 | MaxRetries uint |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 104 | } |
| 105 | |
Girish Gowdru | 6a80bbd | 2019-07-02 07:36:09 -0700 | [diff] [blame] | 106 | // NewAdapterFlags returns a new RWCore config |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 107 | func NewAdapterFlags() *AdapterFlags { |
| 108 | var adapterFlags = AdapterFlags{ // Default values |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 109 | InstanceID: defaultInstanceid, |
| 110 | KafkaClusterAddress: defaultKafkaclusteraddress, |
| 111 | KVStoreType: defaultKvstoretype, |
| 112 | KVStoreTimeout: defaultKvstoretimeout, |
| 113 | KVStoreAddress: defaultKvstoreaddress, |
| 114 | EventTopic: defaultEventtopic, |
| 115 | LogLevel: defaultLoglevel, |
| 116 | OnuNumber: defaultOnunumber, |
| 117 | Banner: defaultBanner, |
| 118 | DisplayVersionOnly: defaultDisplayVersionOnly, |
| 119 | ProbeAddress: defaultProbeAddress, |
| 120 | LiveProbeInterval: defaultLiveProbeInterval, |
| 121 | NotLiveProbeInterval: defaultNotLiveProbeInterval, |
| 122 | HeartbeatCheckInterval: defaultHeartbeatCheckInterval, |
| 123 | HeartbeatFailReportInterval: defaultHeartbeatFailReportInterval, |
| 124 | GrpcAddress: defaultGrpcAddress, |
| 125 | CoreEndpoint: defaultCoreEndpoint, |
| 126 | GrpcTimeoutInterval: defaultGrpcTimeoutInterval, |
| 127 | TraceEnabled: defaultTraceEnabled, |
| 128 | TraceAgentAddress: defaultTraceAgentAddress, |
| 129 | LogCorrelationEnabled: defaultLogCorrelationEnabled, |
| 130 | OmccEncryption: defaultOmccEncryption, |
| 131 | EnableONUStats: defaultEnableONUStats, |
| 132 | EnableGEMStats: defaultEnableGEMStats, |
| 133 | RPCTimeout: defaultRPCTimeout, |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 134 | PerRPCRetryTimeout: defaultPerRPCRetryTimeout, |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 135 | MinBackoffRetryDelay: defaultMinBackoffRetryDelay, |
| 136 | MaxBackoffRetryDelay: defaultMaxBackoffRetryDelay, |
| 137 | CheckOnuDevExistenceAtOnuDiscovery: defaultCheckOnuDevExistenceAtOnuDiscovery, |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 138 | MaxRetries: defaultMaxRetries, |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 139 | } |
| 140 | return &adapterFlags |
| 141 | } |
| 142 | |
| 143 | // ParseCommandArguments parses the arguments when running read-write adaptercore service |
| 144 | func (so *AdapterFlags) ParseCommandArguments() { |
| 145 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 146 | flag.StringVar(&(so.KafkaClusterAddress), |
| 147 | "kafka_cluster_address", |
| 148 | defaultKafkaclusteraddress, |
| 149 | "Kafka - Cluster messaging address") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 150 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 151 | flag.StringVar(&(so.EventTopic), |
| 152 | "event_topic", |
| 153 | defaultEventtopic, |
| 154 | "Event topic") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 155 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 156 | flag.StringVar(&(so.KVStoreType), |
| 157 | "kv_store_type", |
| 158 | defaultKvstoretype, |
| 159 | "KV store type") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 160 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 161 | flag.DurationVar(&(so.KVStoreTimeout), |
| 162 | "kv_store_request_timeout", |
| 163 | defaultKvstoretimeout, |
| 164 | "The default timeout when making a kv store request") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 165 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 166 | flag.StringVar(&(so.KVStoreAddress), |
| 167 | "kv_store_address", |
| 168 | defaultKvstoreaddress, |
| 169 | "KV store address") |
Devmalya Paul | fb990a5 | 2019-07-09 10:01:49 -0400 | [diff] [blame] | 170 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 171 | flag.StringVar(&(so.LogLevel), |
| 172 | "log_level", |
| 173 | defaultLoglevel, |
| 174 | "Log level") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 175 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 176 | flag.IntVar(&(so.OnuNumber), |
| 177 | "onu_number", |
| 178 | defaultOnunumber, |
| 179 | "Number of ONUs") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 180 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 181 | flag.BoolVar(&(so.Banner), |
| 182 | "banner", |
| 183 | defaultBanner, |
| 184 | "Show startup banner log lines") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 185 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 186 | flag.BoolVar(&(so.DisplayVersionOnly), |
| 187 | "version", |
| 188 | defaultDisplayVersionOnly, |
| 189 | "Show version information and exit") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 190 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 191 | flag.StringVar(&(so.ProbeAddress), |
| 192 | "probe_address", |
| 193 | defaultProbeAddress, |
| 194 | "The address on which to listen to answer liveness and readiness probe queries over HTTP.") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 195 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 196 | flag.DurationVar(&(so.LiveProbeInterval), |
| 197 | "live_probe_interval", |
| 198 | defaultLiveProbeInterval, |
| 199 | "Number of seconds for the default liveliness check") |
Matt Jeanneret | f880eb6 | 2019-07-16 20:08:03 -0400 | [diff] [blame] | 200 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 201 | flag.DurationVar(&(so.NotLiveProbeInterval), |
| 202 | "not_live_probe_interval", |
| 203 | defaultNotLiveProbeInterval, |
| 204 | "Number of seconds for liveliness check if probe is not running") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 205 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 206 | flag.DurationVar(&(so.HeartbeatCheckInterval), |
| 207 | "heartbeat_check_interval", |
| 208 | defaultHeartbeatCheckInterval, |
| 209 | "Number of seconds for heartbeat check interval") |
Rohan Agrawal | 828bf4e | 2019-10-22 10:13:19 +0000 | [diff] [blame] | 210 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 211 | flag.DurationVar(&(so.HeartbeatFailReportInterval), |
| 212 | "heartbeat_fail_interval", |
| 213 | defaultHeartbeatFailReportInterval, |
| 214 | "Number of seconds adapter has to wait before reporting core on the heartbeat check failure") |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 215 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 216 | flag.DurationVar(&(so.GrpcTimeoutInterval), |
| 217 | "grpc_timeout_interval", |
| 218 | defaultGrpcTimeoutInterval, |
| 219 | "Number of seconds for GRPC timeout") |
cbabu | 116b73f | 2019-12-10 17:56:32 +0530 | [diff] [blame] | 220 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 221 | flag.IntVar(&(so.CurrentReplica), |
| 222 | "current_replica", |
| 223 | defaultCurrentReplica, |
| 224 | "Replica number of this particular instance") |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 225 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 226 | flag.IntVar(&(so.TotalReplicas), |
| 227 | "total_replica", |
| 228 | defaultTotalReplicas, |
| 229 | "Total number of instances for this adapter") |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 230 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 231 | flag.BoolVar(&(so.TraceEnabled), |
| 232 | "trace_enabled", |
| 233 | defaultTraceEnabled, |
| 234 | "Whether to send logs to tracing agent?") |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 235 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 236 | flag.StringVar(&(so.TraceAgentAddress), |
| 237 | "trace_agent_address", |
| 238 | defaultTraceAgentAddress, |
| 239 | "The address of tracing agent to which span info should be sent") |
Matteo Scandolo | 3ad5d2b | 2020-04-02 17:02:04 -0700 | [diff] [blame] | 240 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 241 | flag.BoolVar(&(so.LogCorrelationEnabled), |
| 242 | "log_correlation_enabled", |
| 243 | defaultLogCorrelationEnabled, |
| 244 | "Whether to enrich log statements with fields denoting operation being executed for achieving correlation?") |
Matteo Scandolo | 3ad5d2b | 2020-04-02 17:02:04 -0700 | [diff] [blame] | 245 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 246 | flag.BoolVar(&(so.OmccEncryption), |
| 247 | "omcc_encryption", |
| 248 | defaultOmccEncryption, |
| 249 | "OMCI Channel encryption status") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 250 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 251 | flag.BoolVar(&(so.EnableONUStats), |
| 252 | "enable_onu_stats", |
| 253 | defaultEnableONUStats, |
| 254 | "Enable ONU Statistics") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 255 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 256 | flag.BoolVar(&(so.EnableGEMStats), |
| 257 | "enable_gem_stats", |
| 258 | defaultEnableGEMStats, |
| 259 | "Enable GEM Statistics") |
Girish Kumar | 11e1597 | 2020-06-15 14:51:10 +0000 | [diff] [blame] | 260 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 261 | flag.StringVar(&(so.GrpcAddress), |
| 262 | "grpc_address", |
| 263 | defaultGrpcAddress, |
| 264 | "Adapter GRPC Server address") |
kesavand | 494c208 | 2020-08-31 11:16:12 +0530 | [diff] [blame] | 265 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 266 | flag.StringVar(&(so.CoreEndpoint), |
| 267 | "core_endpoint", |
| 268 | defaultCoreEndpoint, |
| 269 | "Core endpoint") |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 270 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 271 | flag.StringVar(&(so.AdapterEndpoint), |
| 272 | "adapter_endpoint", |
| 273 | defaultAdapterEndpoint, |
| 274 | "Adapter Endpoint") |
| 275 | |
| 276 | flag.DurationVar(&(so.RPCTimeout), |
| 277 | "rpc_timeout", |
| 278 | defaultRPCTimeout, |
| 279 | "The default timeout when making an RPC request") |
| 280 | |
| 281 | flag.DurationVar(&(so.MinBackoffRetryDelay), |
| 282 | "min_retry_delay", |
| 283 | defaultMinBackoffRetryDelay, |
| 284 | "The minimum number of milliseconds to delay before a connection retry attempt") |
| 285 | |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 286 | flag.DurationVar(&(so.PerRPCRetryTimeout), |
| 287 | "per_rpc_retry_timeout", |
| 288 | defaultPerRPCRetryTimeout, |
| 289 | "The default timeout per RPC retry") |
| 290 | |
khenaidoo | 106c61a | 2021-08-11 18:05:46 -0400 | [diff] [blame] | 291 | flag.DurationVar(&(so.MaxBackoffRetryDelay), |
| 292 | "max_retry_delay", |
| 293 | defaultMaxBackoffRetryDelay, |
| 294 | "The maximum number of milliseconds to delay before a connection retry attempt") |
Gamze Abaka | fcbd6e7 | 2020-12-17 13:25:16 +0000 | [diff] [blame] | 295 | |
nikesh.krishnan | 6dd882b | 2023-03-14 10:02:41 +0530 | [diff] [blame] | 296 | flag.UintVar(&(so.MaxRetries), |
| 297 | "max_grpc_client_retry", |
| 298 | defaultMaxRetries, |
| 299 | "The maximum number of times olt adaptor will retry in case grpc request timeouts") |
| 300 | |
Abhilash Laxmeshwar | d0f58cf | 2022-06-01 12:15:19 +0530 | [diff] [blame] | 301 | flag.BoolVar(&(so.CheckOnuDevExistenceAtOnuDiscovery), |
| 302 | "check_onu_exist_on_discovery", |
| 303 | defaultCheckOnuDevExistenceAtOnuDiscovery, |
| 304 | "Whether to check for flows only or child device before honoring discovery?") |
| 305 | |
Abhilash Laxmeshwar | f9942e9 | 2020-01-07 15:32:44 +0530 | [diff] [blame] | 306 | flag.Parse() |
Girish Gowdru | 0c588b2 | 2019-04-23 23:24:56 -0400 | [diff] [blame] | 307 | containerName := getContainerInfo() |
| 308 | if len(containerName) > 0 { |
| 309 | so.InstanceID = containerName |
| 310 | } |
| 311 | |
| 312 | } |
| 313 | |
| 314 | func getContainerInfo() string { |
| 315 | return os.Getenv("HOSTNAME") |
| 316 | } |