-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathamf.go
45 lines (36 loc) · 925 Bytes
/
amf.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-FileCopyrightText: 2024 Intel Corporation
// SPDX-FileCopyrightText: 2021 Open Networking Foundation <info@opennetworking.org>
// Copyright 2019 free5GC.org
//
// SPDX-License-Identifier: Apache-2.0
//
package main
import (
"fmt"
"os"
"github.com/omec-project/amf/logger"
"github.com/omec-project/amf/service"
"github.com/urfave/cli"
)
var AMF = &service.AMF{}
func main() {
app := cli.NewApp()
app.Name = "amf"
logger.AppLog.Infoln(app.Name)
app.Usage = "Access & Mobility Management function"
app.UsageText = "amf -cfg <amf_config_file.conf>"
app.Action = action
app.Flags = AMF.GetCliCmd()
if err := app.Run(os.Args); err != nil {
logger.AppLog.Fatalf("AMF run error: %v", err)
}
}
func action(c *cli.Context) error {
if err := AMF.Initialize(c); err != nil {
logger.CfgLog.Errorf("%+v", err)
return fmt.Errorf("failed to initialize")
}
AMF.WatchConfig()
AMF.Start()
return nil
}