VOL-2629 Modified Makefile to use containerized tools.

Modified existing containers to build internally, rather than bind-mounting the whole project & running make targets.
This repo has C dependencies, which must be made available, which complicates the usage of containerized tools.  Some tool containers are augmented before use.
"build-" targets will continue to use locally installed golang.
"release-" targets will use containerized tools, and will cross-compile only bbsimctl.

Change-Id: I02c999a29361d26aa9198d1f03b2b050febfe954
diff --git a/internal/bbsim/alarmsim/alarmsim.go b/internal/bbsim/alarmsim/alarmsim.go
index aa80212..b5b62c1 100644
--- a/internal/bbsim/alarmsim/alarmsim.go
+++ b/internal/bbsim/alarmsim/alarmsim.go
@@ -19,6 +19,7 @@
 import (
 	"context"
 	"fmt"
+	"github.com/opencord/bbsim/internal/common"
 	"strconv"
 
 	"github.com/opencord/bbsim/api/bbsim"
@@ -28,43 +29,13 @@
 	"google.golang.org/grpc/status"
 )
 
-// OnuAlarmNameMap string to enum map
-var OnuAlarmNameMap = map[string]bbsim.AlarmType_Types{
-	"DyingGasp":                bbsim.AlarmType_DYING_GASP,
-	"StartupFailure":           bbsim.AlarmType_ONU_STARTUP_FAILURE,
-	"SignalDegrade":            bbsim.AlarmType_ONU_SIGNAL_DEGRADE,
-	"DriftOfWindow":            bbsim.AlarmType_ONU_DRIFT_OF_WINDOW,
-	"LossOfOmciChannel":        bbsim.AlarmType_ONU_LOSS_OF_OMCI_CHANNEL,
-	"SignalsFailure":           bbsim.AlarmType_ONU_SIGNALS_FAILURE,
-	"TransmissionInterference": bbsim.AlarmType_ONU_TRANSMISSION_INTERFERENCE_WARNING,
-	"ActivationFailure":        bbsim.AlarmType_ONU_ACTIVATION_FAILURE,
-	"ProcessingError":          bbsim.AlarmType_ONU_PROCESSING_ERROR,
-	"LossOfKeySyncFailure":     bbsim.AlarmType_ONU_LOSS_OF_KEY_SYNC_FAILURE,
-
-	// Break out OnuAlarm into its subcases.
-	"LossOfSignal":   bbsim.AlarmType_ONU_ALARM_LOS,
-	"LossOfBurst":    bbsim.AlarmType_ONU_ALARM_LOB,
-	"LOPC_MISS":      bbsim.AlarmType_ONU_ALARM_LOPC_MISS,
-	"LOPC_MIC_ERROR": bbsim.AlarmType_ONU_ALARM_LOPC_MIC_ERROR,
-	"LossOfFrame":    bbsim.AlarmType_ONU_ALARM_LOFI,
-	"LossOfPloam":    bbsim.AlarmType_ONU_ALARM_LOAMI,
-}
-
-// OltAlarmNameMap string to enum map
-var OltAlarmNameMap = map[string]bbsim.AlarmType_Types{
-	// PON / Non-onu-specific
-	"PonLossOfSignal": bbsim.AlarmType_LOS,
-	// NNI / Non-onu-specific
-	"NniLossOfSignal": bbsim.AlarmType_LOS,
-}
-
-func AlarmNameToEnum(name string) (*bbsim.AlarmType_Types, error) {
-	v, okay := OnuAlarmNameMap[name]
+func AlarmNameToEnum(name string) (bbsim.AlarmType_Types, error) {
+	v, okay := common.ONUAlarms[name]
 	if !okay {
-		return nil, fmt.Errorf("Unknown Alarm Name: %v", name)
+		return 0, fmt.Errorf("Unknown Alarm Name: %v", name)
 	}
 
-	return &v, nil
+	return v, nil
 }
 
 // Find a key in the optional AlarmParameters, convert it to an integer,
@@ -92,7 +63,7 @@
 		return nil, err
 	}
 
-	if *alarmType != bbsim.AlarmType_LOS {
+	if alarmType != bbsim.AlarmType_LOS {
 		// No ONU Id for LOS
 		onu, err = o.FindOnuBySn(req.SerialNumber)
 		if err != nil {
@@ -100,7 +71,7 @@
 		}
 	}
 
-	switch *alarmType {
+	switch alarmType {
 	case bbsim.AlarmType_DYING_GASP:
 		alarm = &openolt.AlarmIndication{
 			Data: &openolt.AlarmIndication_DyingGaspInd{&openolt.DyingGaspIndication{
@@ -242,7 +213,7 @@
 			}},
 		}
 	default:
-		return nil, fmt.Errorf("Unknown alarm type %v", req.AlarmType)
+		return nil, fmt.Errorf("Unknown ONU alarm type %v", req.AlarmType)
 	}
 
 	return alarm, nil
diff --git a/internal/bbsimctl/commands/oltalarms.go b/internal/bbsimctl/commands/oltalarms.go
index f251b83..b68ca83 100755
--- a/internal/bbsimctl/commands/oltalarms.go
+++ b/internal/bbsimctl/commands/oltalarms.go
@@ -20,13 +20,13 @@
 import (
 	"context"
 	"fmt"
+	"github.com/opencord/bbsim/internal/common"
 	"os"
 	"strings"
 
 	"github.com/jessevdk/go-flags"
 	"github.com/olekukonko/tablewriter"
 	pb "github.com/opencord/bbsim/api/bbsim"
-	"github.com/opencord/bbsim/internal/bbsim/alarmsim"
 	"github.com/opencord/bbsim/internal/bbsimctl/config"
 	log "github.com/sirupsen/logrus"
 )
@@ -79,12 +79,12 @@
 		InterfaceID: uint32(o.Args.IntfID),
 		Status:      "on"}
 
-	if string(o.Args.Name) == "PonLossOfSignal" {
+	if string(o.Args.Name) == common.OltPonLos {
 		req.InterfaceType = "pon"
-	} else if string(o.Args.Name) == "NniLossOfSignal" {
+	} else if string(o.Args.Name) == common.OltNniLos {
 		req.InterfaceType = "nni"
 	} else {
-		return fmt.Errorf("Unknown alarm type")
+		return fmt.Errorf("Unknown OLT alarm type")
 	}
 
 	res, err := client.SetOltAlarmIndication(ctx, &req)
@@ -109,12 +109,12 @@
 		InterfaceID: uint32(o.Args.IntfID),
 		Status:      "off"}
 
-	if string(o.Args.Name) == "PonLossOfSignal" {
+	if string(o.Args.Name) == common.OltPonLos {
 		req.InterfaceType = "pon"
-	} else if string(o.Args.Name) == "NniLossOfSignal" {
+	} else if string(o.Args.Name) == common.OltNniLos {
 		req.InterfaceType = "nni"
 	} else {
-		return fmt.Errorf("Unknown alarm type")
+		return fmt.Errorf("Unknown OLT alarm type")
 	}
 
 	res, err := client.SetOltAlarmIndication(ctx, &req)
@@ -135,9 +135,9 @@
 	fmt.Fprintf(os.Stdout, "OLT Alarms List:\n")
 	OltAlarmstable.SetHeader([]string{"OLT Alarms"})
 
-	alarmNames := make([]AlarmListOutput, len(alarmsim.OltAlarmNameMap))
+	alarmNames := make([]AlarmListOutput, len(common.OLTAlarms))
 	i := 0
-	for k := range alarmsim.OltAlarmNameMap {
+	for k := range common.OLTAlarms {
 		alarmNames[i] = AlarmListOutput{Name: k}
 		OltAlarmsValue = append(OltAlarmsValue, []string{k})
 		i++
@@ -151,7 +151,7 @@
 
 func (o *OltAlarmNameString) Complete(match string) []flags.Completion {
 	list := make([]flags.Completion, 0)
-	for k := range alarmsim.OltAlarmNameMap {
+	for k := range common.OLTAlarms {
 		if strings.HasPrefix(k, match) {
 			list = append(list, flags.Completion{Item: k})
 		}
diff --git a/internal/bbsimctl/commands/onualarms.go b/internal/bbsimctl/commands/onualarms.go
index dcf53a3..fb1d00e 100755
--- a/internal/bbsimctl/commands/onualarms.go
+++ b/internal/bbsimctl/commands/onualarms.go
@@ -20,13 +20,13 @@
 import (
 	"context"
 	"fmt"
+	"github.com/opencord/bbsim/internal/common"
 	"os"
 	"strings"
 
 	"github.com/jessevdk/go-flags"
 	"github.com/olekukonko/tablewriter"
 	pb "github.com/opencord/bbsim/api/bbsim"
-	"github.com/opencord/bbsim/internal/bbsim/alarmsim"
 	"github.com/opencord/bbsim/internal/bbsimctl/config"
 	log "github.com/sirupsen/logrus"
 )
@@ -129,16 +129,16 @@
 	return nil
 }
 
-// Execute OLT alarm list
+// Execute ONU alarm list
 func (o *AlarmList) Execute(args []string) error {
 	OnuAlarmsValue := [][]string{}
 	OnuAlarmstable := tablewriter.NewWriter(os.Stdout)
 	fmt.Fprintf(os.Stdout, "ONU Alarms List:\n")
 	OnuAlarmstable.SetHeader([]string{"ONU Alarms"})
 
-	alarmNames := make([]AlarmListOutput, len(alarmsim.OnuAlarmNameMap))
+	alarmNames := make([]AlarmListOutput, len(common.ONUAlarms))
 	i := 0
-	for k := range alarmsim.OnuAlarmNameMap {
+	for k := range common.ONUAlarms {
 		alarmNames[i] = AlarmListOutput{Name: k}
 		OnuAlarmsValue = append(OnuAlarmsValue, []string{k})
 		i++
@@ -152,7 +152,7 @@
 
 func (onuSn *AlarmNameString) Complete(match string) []flags.Completion {
 	list := make([]flags.Completion, 0)
-	for k := range alarmsim.OnuAlarmNameMap {
+	for k := range common.ONUAlarms {
 		if strings.HasPrefix(k, match) {
 			list = append(list, flags.Completion{Item: k})
 		}
diff --git a/internal/common/alarms.go b/internal/common/alarms.go
new file mode 100644
index 0000000..5102372
--- /dev/null
+++ b/internal/common/alarms.go
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2020-present Open Networking Foundation
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+
+ * http://www.apache.org/licenses/LICENSE-2.0
+
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package common
+
+import (
+	"github.com/opencord/bbsim/api/bbsim"
+)
+
+var ONUAlarms = make(map[string]bbsim.AlarmType_Types)
+
+func init() {
+	for id, name := range bbsim.AlarmType_Types_name {
+		if id := bbsim.AlarmType_Types(id); id != bbsim.AlarmType_LOS {
+			ONUAlarms[name] = id
+		}
+	}
+}
+
+const OltNniLos = "OLT_NNI_LOS"
+const OltPonLos = "OLG_PON_LOS"
+
+var OLTAlarms = map[string]bbsim.AlarmType_Types{
+	OltNniLos: bbsim.AlarmType_LOS,
+	OltPonLos: bbsim.AlarmType_LOS,
+}