blob: 7274bcda49cf48e3b4f3275f9087ac6a0bc0b32d [file] [log] [blame]
Don Newton98fd8812019-09-23 15:15:02 -04001/*
2 Copyright 2017 the original author or authors.
3
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
7
8 http://www.apache.org/licenses/LICENSE-2.0
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 implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15*/
16
17package main
18
19import (
20 "flag"
Don Newton7577f072020-01-06 12:41:11 -050021 "github.com/opencord/ofagent-go/settings"
Don Newton98fd8812019-09-23 15:15:02 -040022
23 "github.com/opencord/ofagent-go/grpc"
Don Newton7577f072020-01-06 12:41:11 -050024 l "github.com/opencord/voltha-lib-go/v2/pkg/log"
Don Newton98fd8812019-09-23 15:15:02 -040025)
26
27func main() {
Don Newton7577f072020-01-06 12:41:11 -050028 debug := flag.Bool("debug", false, "Set Debug Level Logging")
29 var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
30 var memprofile = flag.String("memprofile", "", "write memory profile to `file`")
31
Don Newton98fd8812019-09-23 15:15:02 -040032 openflowAddress := flag.String("ofaddress", "localhost", "address of the openflow server")
33 openflowPort := flag.Uint("openflowPort", 6653, "port the openflow server is listening on")
34 volthaAddress := flag.String("volthaAddress", "localhost", "address for voltha core / afrouter")
35 volthaPort := flag.Uint("volthaPort", 50057, "port that voltha core / afrouter listens on ")
36 flag.Parse()
37
Don Newton7577f072020-01-06 12:41:11 -050038 logLevel := l.InfoLevel
39 if *debug {
40 logLevel = l.DebugLevel
41 settings.SetDebug(true)
42 } else {
43 settings.SetDebug(false)
44 }
45 _, err := l.AddPackage(l.JSON, logLevel, nil)
46 if err != nil {
47 l.Errorw("unable-to-register-package-to-the-log-map", l.Fields{"error": err})
48 }
49 l.Infow("ofagent-startup params", l.Fields{"OpenFlowAddress": *openflowAddress,
50 "OpenFlowPort": *openflowPort,
51 "VolthaAddress": *volthaAddress,
52 "VolthaPort": *volthaPort,
53 "LogLevel": logLevel,
54 "CpuProfile": *cpuprofile,
55 "MemProfile": *memprofile})
56
Don Newton98fd8812019-09-23 15:15:02 -040057 grpc.StartClient(*volthaAddress, uint16(*volthaPort), *openflowAddress, uint16(*openflowPort))
58}