Skip to content

Commit

Permalink
Merge branch 'master' of github.com:magma/magma
Browse files Browse the repository at this point in the history
* 'master' of github.com:magma/magma: (31 commits)
  [AGW]: uplink_br0: configure using DHCP (magma#2218)
  Remove axios as a package dependency from magmalte. (magma#2246)
  [pipelined] Add conntrack pipelined controller (magma#2191)
  Bump dotenv from 6.2.0 to 8.2.0 in /nms/app (magma#2247)
  Bump nodemon from 1.19.4 to 2.0.4 in /nms/app (magma#2248)
  Bump @testing-library/react from 9.5.0 to 10.4.8 in /nms/app (magma#2249)
  [orc8r][cwf]LI swagger API update (magma#2170)
  [AGW] MME: add retry for mobility ip block read API. (magma#2233)
  Refactored CardTitleRow into single component (magma#2224)
  Add policy JSON editor (magma#2182)
  [lte][agw] Updating _get_enb_label_from_request to get IP from peername request (magma#2244)
  Make gateway ID a link in Gateway overview page (magma#2232)
  Fix metric label used for querying (magma#2241)
  Hide gateway status in JSON editor (magma#2223)
  Bump postcss-flexbugs-fixes from 3.3.1 to 4.2.1 in /nms/app (magma#2236)
  Bump regenerator-runtime from 0.13.5 to 0.13.7 in /nms/app (magma#2234)
  Bump @testing-library/react-hooks from 3.3.0 to 3.4.1 in /nms/app (magma#2235)
  Clean up Session Recycling Logic (magma#2149)
  Migrate CreateSessionRequest to use bundled fields (magma#2166)
  orc8r-values.tpl YAML template fix (magma#2228)
  ...
  • Loading branch information
ardzoht committed Aug 10, 2020
2 parents 06a7a7c + 23440bd commit 6ed8e3e
Show file tree
Hide file tree
Showing 350 changed files with 4,617 additions and 2,368 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Expand Up @@ -714,14 +714,14 @@ jobs:
machine:
image: ubuntu-1604:201903-01
environment:
- NMS_ROOT=${MAGMA_ROOT}/nms/app/fbcnms-projects/magmalte
- NMS_ROOT=${MAGMA_ROOT}/nms/app/packages/magmalte
steps:
- checkout
- docker/install-dc
- run: echo 'export MAGMA_ROOT=$(pwd)' >> $BASH_ENV
- run:
command: |
cd ${MAGMA_ROOT}/nms/app/fbcnms-projects/magmalte
cd ${MAGMA_ROOT}/nms/app/packages/magmalte
docker-compose build magmalte
- tag-push-docker:
project: magmalte
Expand Down
2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# Magma

[![facebookincubator](https://circleci.com/gh/facebookincubator/magma.svg?style=shield)](https://circleci.com/gh/facebookincubator/magma)
[![magma](https://circleci.com/gh/magma/magma.svg?style=shield)](https://circleci.com/gh/magma/magma)

Magma is an open-source software platform that gives network operators an open, flexible and extendable mobile core network solution. Magma enables better connectivity by:

Expand Down
3 changes: 0 additions & 3 deletions cwf/cloud/go/go.sum
Expand Up @@ -66,7 +66,6 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/docker/docker v1.13.1/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
Expand All @@ -91,7 +90,6 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q=
github.com/go-bindata/go-bindata v1.0.1-0.20190711162640-ee3c2418e368/go.mod h1:7xCgX1lzlrXPHkfvn3EhumqHkmSlzt8at9q7v0ax19c=
github.com/go-check/check v0.0.0-20200227125254-8fa46927fb4f/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
Expand Down Expand Up @@ -284,7 +282,6 @@ github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJ
github.com/moriyoshi/routewrapper v0.0.0-20180228100351-e52d8d14cf39/go.mod h1:58NWw+g5pMuFB1BxO0ZVEQRDC09iqiiI5JHBGtl5Jyk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223 h1:F9x/1yl3T2AeKLr2AMdilSD8+f9bvMnNN8VS5iDtovc=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/oklog/ulid v0.0.0-20170117200651-66bb6560562f/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4=
Expand Down
19 changes: 18 additions & 1 deletion cwf/cloud/go/plugin/mconfig.go
Expand Up @@ -145,6 +145,10 @@ func buildFromConfigs(nwConfig *models.NetworkCarrierWifiConfigs, gwConfig *mode
if err != nil {
return ret, err
}
liUes, err := getPipelineDLiUes(nwConfig.LiUes)
if err != nil {
return ret, err
}
ipdrExportDst, err := getPipelineDIpdrExportDst(gwConfig.IPDRExportDst)
if err != nil {
return ret, err
Expand All @@ -169,7 +173,7 @@ func buildFromConfigs(nwConfig *models.NetworkCarrierWifiConfigs, gwConfig *mode
DefaultRuleId: swag.StringValue(nwConfig.DefaultRuleID),
Services: pipelineDServices,
AllowedGrePeers: allowedGrePeers,
LiImsis: gwConfig.LiImsis,
LiUes: liUes,
IpdrExportDst: ipdrExportDst,
}
ret["sessiond"] = &ltemconfig.SessionD{
Expand Down Expand Up @@ -251,3 +255,16 @@ func getHealthServiceGrePeers(pipelinedPeers []*ltemconfig.PipelineD_AllowedGreP
}
return healthPeers
}

func getPipelineDLiUes(liUes *models.LiUes) (*ltemconfig.PipelineD_LiUes, error) {
if liUes == nil {
return nil, nil
}
dst := &ltemconfig.PipelineD_LiUes{
Imsis: liUes.Imsis,
Msisdns: liUes.Msisdns,
Macs: liUes.Macs,
Ips: liUes.Ips,
}
return dst, nil
}
18 changes: 12 additions & 6 deletions cwf/cloud/go/plugin/mconfig_test.go
Expand Up @@ -100,8 +100,11 @@ func TestBuilder_Build(t *testing.T) {
{Ip: "1.2.3.4/24"},
{Ip: "1.1.1.1/24", Key: 111},
},
LiImsis: []string{
"IMSI001010000000013",
LiUes: &ltemconfig.PipelineD_LiUes{
Imsis: []string{"IMSI001010000000013"},
Ips: []string{"192.16.8.1"},
Macs: []string{"00:33:bb:aa:cc:33"},
Msisdns: []string{"57192831"},
},
IpdrExportDst: &ltemconfig.PipelineD_IPDRExportDst{
Ip: "192.168.128.88",
Expand Down Expand Up @@ -154,17 +157,20 @@ var defaultnwConfig = &models.NetworkCarrierWifiConfigs{
CreateSessionOnAuth: false,
},
NetworkServices: []string{"dpi", "policy_enforcement"},
DefaultRuleID: swag.String(""),
LiUes: &models.LiUes{
Imsis: []string{"IMSI001010000000013"},
Ips: []string{"192.16.8.1"},
Macs: []string{"00:33:bb:aa:cc:33"},
Msisdns: []string{"57192831"},
},
DefaultRuleID: swag.String(""),
}

var defaultgwConfig = &models.GatewayCwfConfigs{
AllowedGrePeers: models.AllowedGrePeers{
{IP: "1.2.3.4/24"},
{IP: "1.1.1.1/24", Key: swag.Uint32(111)},
},
LiImsis: []string{
"IMSI001010000000013",
},
IPDRExportDst: &models.IPDRExportDst{
IP: "192.168.128.88",
Port: 2040,
Expand Down
4 changes: 2 additions & 2 deletions cwf/cloud/go/services/cwf/obsidian/handlers/handlers.go
Expand Up @@ -54,13 +54,13 @@ const (
ManageNetworkBaseNamePath = ManageNetworkBaseNamesPath + obsidian.UrlSep + ":base_name"
ManageNetworkRuleNamePath = ManageNetworkRuleNamesPath + obsidian.UrlSep + ":rule_id"
ManageNetworkClusterStatusPath = ManageNetworkPath + obsidian.UrlSep + "cluster_status"
ManageNetworkLiUesPath = ManageNetworkPath + obsidian.UrlSep + ":li_ues"

Gateways = "gateways"
ListGatewaysPath = ManageNetworkPath + obsidian.UrlSep + Gateways
ManageGatewayPath = ListGatewaysPath + obsidian.UrlSep + ":gateway_id"
ManageGatewayNamePath = ManageGatewayPath + obsidian.UrlSep + "name"
ManageGatewayDescriptionPath = ManageGatewayPath + obsidian.UrlSep + "description"
ManageGatewayLiImsisPath = ManageGatewayPath + obsidian.UrlSep + "li_imsis"
ManageGatewayConfigPath = ManageGatewayPath + obsidian.UrlSep + "magmad"
ManageGatewayDevicePath = ManageGatewayPath + obsidian.UrlSep + "device"
ManageGatewayStatePath = ManageGatewayPath + obsidian.UrlSep + "status"
Expand Down Expand Up @@ -103,10 +103,10 @@ func GetHandlers() []obsidian.Handler {
ret = append(ret, handlers.GetPartialNetworkHandlers(ManageNetworkSubscriberPath, &policyModels.NetworkSubscriberConfig{}, "")...)
ret = append(ret, handlers.GetPartialNetworkHandlers(ManageNetworkRuleNamesPath, new(policyModels.RuleNames), "")...)
ret = append(ret, handlers.GetPartialNetworkHandlers(ManageNetworkBaseNamesPath, new(policyModels.BaseNames), "")...)
ret = append(ret, handlers.GetPartialNetworkHandlers(ManageNetworkLiUesPath, new(cwfModels.LiUes), "")...)

ret = append(ret, handlers.GetPartialGatewayHandlers(ManageGatewayNamePath, new(models.GatewayName))...)
ret = append(ret, handlers.GetPartialGatewayHandlers(ManageGatewayDescriptionPath, new(models.GatewayDescription))...)
ret = append(ret, handlers.GetPartialGatewayHandlers(ManageGatewayLiImsisPath, new(cwfModels.LiImsis))...)
ret = append(ret, handlers.GetPartialGatewayHandlers(ManageGatewayConfigPath, &orc8rModels.MagmadGatewayConfigs{})...)
ret = append(ret, handlers.GetPartialGatewayHandlers(ManageGatewayTierPath, new(orc8rModels.TierID))...)
ret = append(ret, handlers.GetGatewayDeviceHandlers(ManageGatewayDevicePath)...)
Expand Down
58 changes: 34 additions & 24 deletions cwf/cloud/go/services/cwf/obsidian/handlers/handlers_test.go
Expand Up @@ -69,6 +69,8 @@ func TestCwfNetworks(t *testing.T) {
getCarrierWifiConfig := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/carrier_wifi", obsidian.GET).HandlerFunc
getSubscriberDirectory := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/subscribers/:subscriber_id/directory_record", obsidian.GET).HandlerFunc
getClusterStatus := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/cluster_status", obsidian.GET).HandlerFunc
getCarrierWifiLiUes := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/:li_ues", obsidian.GET).HandlerFunc
updateCarrierWifiLiUes := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/:li_ues", obsidian.PUT).HandlerFunc

// Test ListNetworks
tc := tests.Test{
Expand Down Expand Up @@ -297,6 +299,38 @@ func TestCwfNetworks(t *testing.T) {
}
tests.RunUnitTest(t, e, tc)

// Test update gateway LI UEs config
tc = tests.Test{
Method: "PUT",
URL: "/magma/v1/cwf/n1/li_ues",
Handler: updateCarrierWifiLiUes,
Payload: &models2.LiUes{
Imsis: []string{"IMSI001010000000013"},
Ips: []string{"192.16.8.1"},
Macs: []string{"00:33:bb:aa:cc:33"},
Msisdns: []string{"57192831"},
},
ParamNames: []string{"network_id", "gateway_id"},
ParamValues: []string{"n1", "g1"},
ExpectedStatus: 204,
}
tests.RunUnitTest(t, e, tc)
tc = tests.Test{
Method: "GET",
URL: "/magma/v1/cwf/n1/li_ues",
Handler: getCarrierWifiLiUes,
ParamNames: []string{"network_id"},
ParamValues: []string{"n1"},
ExpectedStatus: 200,
ExpectedResult: &models2.LiUes{
Imsis: []string{"IMSI001010000000013"},
Ips: []string{"192.16.8.1"},
Macs: []string{"00:33:bb:aa:cc:33"},
Msisdns: []string{"57192831"},
},
}
tests.RunUnitTest(t, e, tc)

// Test DeleteNetwork
tc = tests.Test{
Method: "DELETE",
Expand Down Expand Up @@ -336,8 +370,6 @@ func TestCwfGateways(t *testing.T) {
getGateway := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id", obsidian.GET).HandlerFunc
getCarrierWifiGatewayConfig := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id/carrier_wifi", obsidian.GET).HandlerFunc
updateCarrierWifiGatewayConfig := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id/carrier_wifi", obsidian.PUT).HandlerFunc
getCarrierWifiGatewayLiImsis := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id/li_imsis", obsidian.GET).HandlerFunc
updateCarrierWifiGatewayLiImsis := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id/li_imsis", obsidian.PUT).HandlerFunc
updateGateway := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id", obsidian.PUT).HandlerFunc
deleteGateway := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways/:gateway_id", obsidian.DELETE).HandlerFunc
createGateway := tests.GetHandlerByPathAndMethod(t, obsidianHandlers, "/magma/v1/cwf/:network_id/gateways", obsidian.POST).HandlerFunc
Expand Down Expand Up @@ -580,27 +612,6 @@ func TestCwfGateways(t *testing.T) {
}
tests.RunUnitTest(t, e, tc)

// Test update gateway LiImsis config
tc = tests.Test{
Method: "PUT",
URL: "/magma/v1/cwf/n1/gateways/g1/li_imsis",
Handler: updateCarrierWifiGatewayLiImsis,
Payload: tests.JSONMarshaler([]string{"IMSI001010000000009"}),
ParamNames: []string{"network_id", "gateway_id"},
ParamValues: []string{"n1", "g1"},
ExpectedStatus: 204,
}
tests.RunUnitTest(t, e, tc)
tc = tests.Test{
Method: "GET",
URL: "/magma/v1/cwf/n1/gateways/g1/li_imsis",
Handler: getCarrierWifiGatewayLiImsis,
ParamNames: []string{"network_id", "gateway_id"},
ParamValues: []string{"n1", "g1"},
ExpectedStatus: 200,
ExpectedResult: tests.JSONMarshaler([]string{"IMSI001010000000009"}),
}

// Test get gateway CarrierWifi config
expectedGwConfGet = &models2.GatewayCwfConfigs{
AllowedGrePeers: models2.AllowedGrePeers{
Expand All @@ -612,7 +623,6 @@ func TestCwfGateways(t *testing.T) {
CPUUtilThresholdPct: 0.8,
MemUtilThresholdPct: 0.6,
},
LiImsis: []string{"IMSI001010000000009"},
}
tc = tests.Test{
Method: "GET",
Expand Down
28 changes: 12 additions & 16 deletions cwf/cloud/go/services/cwf/obsidian/models/conversion.go
Expand Up @@ -202,27 +202,23 @@ func (m *NetworkCarrierWifiConfigs) GetFromNetwork(network configurator.Network)
return orc8rModels.GetNetworkConfig(network, cwf.CwfNetworkType)
}

func (m *LiImsis) FromBackendModels(networkID string, gatewayID string) error {
carrierWifi := &GatewayCwfConfigs{}
err := carrierWifi.FromBackendModels(networkID, gatewayID)
if err != nil {
return err
func (m *LiUes) ToUpdateCriteria(network configurator.Network) (configurator.NetworkUpdateCriteria, error) {
networkConfig := orc8rModels.GetNetworkConfig(network, cwf.CwfNetworkType)
if networkConfig == nil {
return configurator.NetworkUpdateCriteria{}, merrors.ErrNotFound
}
*m = carrierWifi.LiImsis

return nil
networkConfig.(*NetworkCarrierWifiConfigs).LiUes = m
return orc8rModels.GetNetworkConfigUpdateCriteria(network.ID, cwf.CwfNetworkType, networkConfig), nil
}

func (m *LiImsis) ToUpdateCriteria(networkID string, gatewayID string) ([]configurator.EntityUpdateCriteria, error) {
carrierWifi := &GatewayCwfConfigs{}
err := carrierWifi.FromBackendModels(networkID, gatewayID)
if err != nil {
return nil, err
func (m *LiUes) GetFromNetwork(network configurator.Network) interface{} {
networkConfig := orc8rModels.GetNetworkConfig(network, cwf.CwfNetworkType)
if networkConfig == nil {
return nil
}
carrierWifi.LiImsis = *m
return carrierWifi.ToUpdateCriteria(networkID, gatewayID)
return networkConfig.(*NetworkCarrierWifiConfigs).LiUes
}

func (m *LiImsis) ValidateModel() error {
func (m *LiUes) ValidateModel() error {
return m.Validate(strfmt.Default)
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6ed8e3e

Please sign in to comment.