blob: 1be60a45a9e24d8021fb5375fbc61a3e02d6cd8d [file] [log] [blame]
Don Newton98fd8812019-09-23 15:15:02 -04001/*
Don Newtona6f55052020-01-09 10:38:45 -05002 Copyright 2019 the original author or authors.
Don Newton98fd8812019-09-23 15:15:02 -04003
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 Newtona6f55052020-01-09 10:38:45 -050021
Don Newton7577f072020-01-06 12:41:11 -050022 "github.com/opencord/ofagent-go/settings"
Don Newton98fd8812019-09-23 15:15:02 -040023
24 "github.com/opencord/ofagent-go/grpc"
Don Newton7577f072020-01-06 12:41:11 -050025 l "github.com/opencord/voltha-lib-go/v2/pkg/log"
Don Newton98fd8812019-09-23 15:15:02 -040026)
27
28func main() {
Don Newton7577f072020-01-06 12:41:11 -050029 debug := flag.Bool("debug", false, "Set Debug Level Logging")
30 var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
31 var memprofile = flag.String("memprofile", "", "write memory profile to `file`")
32
Don Newton98fd8812019-09-23 15:15:02 -040033 openflowAddress := flag.String("ofaddress", "localhost", "address of the openflow server")
34 openflowPort := flag.Uint("openflowPort", 6653, "port the openflow server is listening on")
35 volthaAddress := flag.String("volthaAddress", "localhost", "address for voltha core / afrouter")
36 volthaPort := flag.Uint("volthaPort", 50057, "port that voltha core / afrouter listens on ")
37 flag.Parse()
38
Don Newton7577f072020-01-06 12:41:11 -050039 logLevel := l.InfoLevel
40 if *debug {
41 logLevel = l.DebugLevel
42 settings.SetDebug(true)
43 } else {
44 settings.SetDebug(false)
45 }
46 _, err := l.AddPackage(l.JSON, logLevel, nil)
47 if err != nil {
48 l.Errorw("unable-to-register-package-to-the-log-map", l.Fields{"error": err})
49 }
50 l.Infow("ofagent-startup params", l.Fields{"OpenFlowAddress": *openflowAddress,
51 "OpenFlowPort": *openflowPort,
52 "VolthaAddress": *volthaAddress,
53 "VolthaPort": *volthaPort,
54 "LogLevel": logLevel,
55 "CpuProfile": *cpuprofile,
56 "MemProfile": *memprofile})
57
Don Newton98fd8812019-09-23 15:15:02 -040058 grpc.StartClient(*volthaAddress, uint16(*volthaPort), *openflowAddress, uint16(*openflowPort))
59}