Skip to content

Commit

Permalink
[orc8r][NetworkProbe] Support NetworkProbe APIs in swagger (#4962)
Browse files Browse the repository at this point in the history
* [orc8r][NetworkProbe] Support NetworkProbe APIs in swagger

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>

* [orc8r][NetworkProbe] add unit tests

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>

* [orc8r][NetworkProbe] move swagger definitions to a separate service

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>

* [orc8r][NetworkProbe] update correlation field

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>

* [orc8r][NetworkProbe] fix nits and change correlation_id type to uint64

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>

* Fix review comments

Signed-off-by: YOUSSEF EL MASMOUDI <ymasmoudi@fb.com>
  • Loading branch information
ymasmoudi committed Apr 6, 2021
1 parent 1a4b2b3 commit 50b35a7
Show file tree
Hide file tree
Showing 21 changed files with 2,284 additions and 12 deletions.
11 changes: 11 additions & 0 deletions lte/cloud/configs/nprobe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# Copyright 2020 The Magma Authors.

# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# 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.
13 changes: 13 additions & 0 deletions lte/cloud/configs/service_registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,16 @@ services:
annotations:
orc8r.io/obsidian_handlers_path_prefixes: >
/magma/v1/lte/:network_id/sms,
nprobe:
host: "localhost"
port: 9666
echo_port: 10088
proxy_type: "clientcert"
labels:
orc8r.io/obsidian_handlers: "true"
orc8r.io/swagger_spec: "true"
annotations:
orc8r.io/obsidian_handlers_path_prefixes: >
/magma/v1/lte/:network_id/network_probe/tasks,
/magma/v1/lte/:network_id/network_probe/destinations,
24 changes: 13 additions & 11 deletions lte/cloud/go/lte/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ const (
NetworkSubscriberConfigType = "network_subscriber_config"

// APNEntityType etc. are configurator network entity types.
APNEntityType = "apn"
APNPolicyProfileEntityType = "apn_policy_profile"
APNResourceEntityType = "apn_resource"
BaseNameEntityType = "base_name"
CellularEnodebEntityType = "cellular_enodeb"
CellularGatewayEntityType = "cellular_gateway"
CellularGatewayPoolEntityType = "cellular_gateway_pool"
PolicyQoSProfileEntityType = "policy_qos_profile"
PolicyRuleEntityType = "policy"
RatingGroupEntityType = "rating_group"
SubscriberEntityType = "subscriber"
APNEntityType = "apn"
APNPolicyProfileEntityType = "apn_policy_profile"
APNResourceEntityType = "apn_resource"
BaseNameEntityType = "base_name"
CellularEnodebEntityType = "cellular_enodeb"
CellularGatewayEntityType = "cellular_gateway"
CellularGatewayPoolEntityType = "cellular_gateway_pool"
PolicyQoSProfileEntityType = "policy_qos_profile"
PolicyRuleEntityType = "policy"
RatingGroupEntityType = "rating_group"
SubscriberEntityType = "subscriber"
NetworkProbeTaskEntityType = "network_probe_task"
NetworkProbeDestinationEntityType = "network_probe_destination"

// ApnRuleMappingsStreamName etc. are streamer stream names.
ApnRuleMappingsStreamName = "apn_rule_mappings"
Expand Down
4 changes: 3 additions & 1 deletion lte/cloud/go/serdes/serdes.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package serdes
import (
"magma/lte/cloud/go/lte"
lte_models "magma/lte/cloud/go/services/lte/obsidian/models"
nprobe_models "magma/lte/cloud/go/services/nprobe/obsidian/models"
policydb_models "magma/lte/cloud/go/services/policydb/obsidian/models"
subscriberdb_models "magma/lte/cloud/go/services/subscriberdb/obsidian/models"
"magma/orc8r/cloud/go/serde"
Expand All @@ -34,7 +35,8 @@ var (
Entity = serdes.Entity.
MustMerge(lte_models.EntitySerdes).
MustMerge(subscriberdb_models.EntitySerdes).
MustMerge(policydb_models.EntitySerdes)
MustMerge(policydb_models.EntitySerdes).
MustMerge(nprobe_models.EntitySerdes)
// State contains the full set of state serdes used in the LTE module
State = serdes.State.MustMerge(serde.NewRegistry(
state.NewStateSerde(lte.EnodebStateType, &lte_models.EnodebState{}),
Expand Down
17 changes: 17 additions & 0 deletions lte/cloud/go/services/nprobe/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
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 nprobe provides the network probe service.
package nprobe

const ServiceName = "nprobe"
46 changes: 46 additions & 0 deletions lte/cloud/go/services/nprobe/nprobe/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Copyright 2020 The Magma Authors.
This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree.
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 main

import (
"magma/lte/cloud/go/lte"
"magma/lte/cloud/go/services/nprobe"
"magma/lte/cloud/go/services/nprobe/obsidian/handlers"

"magma/orc8r/cloud/go/obsidian"
"magma/orc8r/cloud/go/obsidian/swagger"
"magma/orc8r/cloud/go/obsidian/swagger/protos"
"magma/orc8r/cloud/go/service"

"github.com/golang/glog"
)

func main() {
// Create service
srv, err := service.NewOrchestratorService(lte.ModuleName, nprobe.ServiceName)
if err != nil {
glog.Fatalf("Error creating service: %v", err)
}

// Attach handlers
obsidian.AttachHandlers(srv.EchoServer, handlers.GetHandlers())
protos.RegisterSwaggerSpecServer(srv.GrpcServer, swagger.NewSpecServicerFromFile(nprobe.ServiceName))

// Run service
err = srv.Run()
if err != nil {
glog.Fatalf("Error while running service and echo server: %v", err)
}

}
Loading

0 comments on commit 50b35a7

Please sign in to comment.