diff --git a/cwf/gateway/docker/docker-compose.integ-test.yml b/cwf/gateway/docker/docker-compose.integ-test.yml index 8bade8da76d7..0e539f3b4393 100644 --- a/cwf/gateway/docker/docker-compose.integ-test.yml +++ b/cwf/gateway/docker/docker-compose.integ-test.yml @@ -100,3 +100,9 @@ services: command: > /bin/bash -c "/usr/bin/redis-server /var/opt/magma/redis.conf --daemonize no && /usr/bin/redis-cli shutdown" + + uesim: + <<: *service + container_name: uesim + image: ${DOCKER_REGISTRY}uesim:${IMAGE_VERSION} + command: envdir /var/opt/magma/envdir /var/opt/magma/bin/uesim -logtostderr=true -v=0 \ No newline at end of file diff --git a/cwf/gateway/docker/docker-compose.override.yml b/cwf/gateway/docker/docker-compose.override.yml index 8072f1583f9b..f15a3faaf7ff 100644 --- a/cwf/gateway/docker/docker-compose.override.yml +++ b/cwf/gateway/docker/docker-compose.override.yml @@ -34,4 +34,9 @@ services: sessiond: build: context: ${BUILD_CONTEXT} - dockerfile: lte/gateway/docker/c/Dockerfile \ No newline at end of file + dockerfile: lte/gateway/docker/c/Dockerfile + + uesim: + build: + context: ${BUILD_CONTEXT} + dockerfile: cwf/gateway/docker/go/Dockerfile \ No newline at end of file diff --git a/cwf/gateway/docker/go/Dockerfile b/cwf/gateway/docker/go/Dockerfile new file mode 100644 index 000000000000..dedec8e3c29f --- /dev/null +++ b/cwf/gateway/docker/go/Dockerfile @@ -0,0 +1,122 @@ +ARG baseImage="ubuntu:xenial" +FROM ${baseImage} as base + +# Add the magma apt repo +RUN apt-get update && \ + apt-get install -y apt-utils software-properties-common apt-transport-https +COPY orc8r/tools/ansible/roles/pkgrepo/files/jfrog.pub /tmp/jfrog.pub +RUN apt-key add /tmp/jfrog.pub && \ + apt-add-repository "deb https://magma.jfrog.io/magma/list/dev/ xenial main" + +# Install the runtime deps. +RUN apt-get update && apt-get install -y \ + bzr \ + curl \ + daemontools \ + gcc \ + git \ + libc-ares-dev \ + libev-dev \ + libevent-dev \ + libffi-dev \ + libjansson-dev \ + libjemalloc-dev \ + libssl-dev \ + libsystemd-dev \ + magma-nghttpx=1.31.1-1 \ + make \ + net-tools \ + pkg-config \ + python-cffi \ + python3-pip \ + redis-server \ + rsyslog \ + sudo \ + unzip \ + vim \ + virtualenv + +# Install Golang 1.12. +WORKDIR /usr/local +RUN curl https://dl.google.com/go/go1.12.4.linux-amd64.tar.gz -O && \ + tar xvf go1.12.4.linux-amd64.tar.gz && \ + cp -r go/bin/* /usr/local/bin/ + +# Install protobuf compiler. +RUN curl -Lfs https://github.com/google/protobuf/releases/download/v3.1.0/protoc-3.1.0-linux-x86_64.zip -o protoc3.zip && \ + unzip protoc3.zip -d protoc3 && \ + mv protoc3/bin/protoc /bin/protoc && \ + chmod a+rx /bin/protoc && \ + mv protoc3/include/google /usr/include/ && \ + chmod -R a+Xr /usr/include/google && \ + rm -rf protoc3.zip protoc3 + +ENV GOBIN /var/opt/magma/bin +ENV MAGMA_ROOT /magma +ENV PIP_CACHE_HOME ~/.pipcache +ENV PYTHON_BUILD /build/python +ENV PATH ${PYTHON_BUILD}/bin:${PATH}:${GOBIN} +ENV GO111MODULE on +# Use public go modules proxy +ENV GOPROXY https://proxy.golang.org + +RUN printenv > /etc/environment + + +# Copy just the go.mod and go.sum files to download the golang deps. +# This step allows us to cache the downloads, and prevents reaching out to +# the internet unless any of the go.mod or go.sum files are changed. +COPY cwf/cloud/go/go.* $MAGMA_ROOT/cwf/cloud/go/ +COPY lte/cloud/go/go.* $MAGMA_ROOT/lte/cloud/go/ +COPY feg/cloud/go/go.* $MAGMA_ROOT/feg/cloud/go/ +COPY feg/cloud/go/protos/go.* $MAGMA_ROOT/feg/cloud/go/protos/ +COPY feg/radius/lib/go/ $MAGMA_ROOT/feg/radius/lib/go/ +COPY feg/radius/src/go.* $MAGMA_ROOT/feg/radius/src/ +COPY feg/gateway/go.* $MAGMA_ROOT/feg/gateway/ +COPY orc8r/cloud/go/go.* $MAGMA_ROOT/orc8r/cloud/go/ +COPY orc8r/gateway/go/go.* $MAGMA_ROOT/orc8r/gateway/go/ +WORKDIR $MAGMA_ROOT/cwf/gateway +RUN go mod download; exit 0 +# Install protoc-gen-go +RUN go install github.com/golang/protobuf/protoc-gen-go; exit 0 + +# Copy the configs. +COPY orc8r/cloud/docker/proxy/magma_headers.rb /etc/nghttpx/magma_headers.rb + +# Symlink python scripts. +RUN ln -s /build/python/bin/generate_service_config.py /usr/local/bin/generate_service_config.py +RUN ln -s /build/python/bin/generate_nghttpx_config.py /usr/local/bin/generate_nghttpx_config.py + +# Build the code. +COPY cwf $MAGMA_ROOT/cwf +COPY feg $MAGMA_ROOT/feg +COPY lte/cloud $MAGMA_ROOT/lte/cloud +COPY orc8r/cloud $MAGMA_ROOT/orc8r/cloud +COPY orc8r/gateway/go $MAGMA_ROOT/orc8r/gateway/go + +# ----------------------------------------------------------------------------- +# Builder image with binary +# ----------------------------------------------------------------------------- +FROM base as builder +# Enable make gen if proto gen is required +# RUN make -C $MAGMA_ROOT/cwf/gateway gen +RUN make -C $MAGMA_ROOT/cwf/gateway build + +# ----------------------------------------------------------------------------- +# Production image +# ----------------------------------------------------------------------------- +FROM ubuntu:xenial AS uesim + +# Install envdir. +RUN apt-get -y update && apt-get -y install daemontools + +# Copy the build artifacts. +COPY --from=builder /var/opt/magma/bin /var/opt/magma/bin + +# Copy the configs. +COPY cwf/gateway/configs /etc/magma + +# Create empty envdir directory +RUN mkdir -p /var/opt/magma/envdir + +RUN mkdir -p /var/opt/magma/configs diff --git a/cwf/gateway/go.sum b/cwf/gateway/go.sum index 8eec491f54b5..ed249f0a9f55 100644 --- a/cwf/gateway/go.sum +++ b/cwf/gateway/go.sum @@ -74,6 +74,7 @@ github.com/facebookincubator/ent v0.0.0-20191128071424-29c7b0a0d805 h1:Gqrw3IfjW github.com/facebookincubator/ent v0.0.0-20191128071424-29c7b0a0d805/go.mod h1:3CGvz1m+D78JUti7JFkY6AkKj88McWuT80UcamLqEJQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fiorix/go-diameter/v4 v4.0.1-0.20200102140015-a6c006d17e34/go.mod h1:Qx/+pf+c9sBUHWq1d7EH3bkdwN8U0mUpdy9BieDw6UQ= +github.com/fiorix/go-diameter/v4 v4.0.1/go.mod h1:Qx/+pf+c9sBUHWq1d7EH3bkdwN8U0mUpdy9BieDw6UQ= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/getsentry/raven-go v0.1.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= diff --git a/devmand/gateway/CMakeLists.txt b/devmand/gateway/CMakeLists.txt index 55eddd822ba3..7f0b64ed096c 100644 --- a/devmand/gateway/CMakeLists.txt +++ b/devmand/gateway/CMakeLists.txt @@ -213,6 +213,7 @@ add_executable(devmantest ${PROJECT_SOURCE_DIR}/src/devmand/test/ConfigGeneratorTest.cpp ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/RealCliDeviceTest.cpp ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/CliScaleTest.cpp + ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/CliTest.cpp ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/PromptAwareCliTest.cpp ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/TimeoutTrackingCliTest.cpp ${PROJECT_SOURCE_DIR}/src/devmand/test/cli/SshSessionTest.cpp diff --git a/devmand/gateway/src/devmand/channels/cli/QueuedCli.cpp b/devmand/gateway/src/devmand/channels/cli/QueuedCli.cpp index cddde49fa415..31f93e6ae0d8 100644 --- a/devmand/gateway/src/devmand/channels/cli/QueuedCli.cpp +++ b/devmand/gateway/src/devmand/channels/cli/QueuedCli.cpp @@ -100,7 +100,7 @@ SemiFuture QueuedCli::executeWrite(const WriteCommand cmd) { Command command = cmd; if (!command.isMultiCommand()) { // Single line config command, execute with read - return executeRead(ReadCommand::create(cmd)); + return executeRead(ReadCommand::create(cmd.raw(), true)); //skip cache } const vector& commands = command.splitMultiCommand(); @@ -119,7 +119,7 @@ SemiFuture QueuedCli::executeWrite(const WriteCommand cmd) { } commmandsFutures.emplace_back( - executeRead(ReadCommand::create(commands.back())) + executeRead(ReadCommand::create(commands.back().raw(), true)) //skip cache .via(queuedParameters->serialExecutorKeepAlive)); return reduce( diff --git a/devmand/gateway/src/devmand/test/cli/CliTest.cpp b/devmand/gateway/src/devmand/test/cli/CliTest.cpp new file mode 100644 index 000000000000..cc520fcc8a88 --- /dev/null +++ b/devmand/gateway/src/devmand/test/cli/CliTest.cpp @@ -0,0 +1,92 @@ +// Copyright (c) 2019-present, Facebook, Inc. +// All rights reserved. +// +// This source code is licensed under the BSD-style license found in the +// LICENSE file in the root directory of this source tree. An additional grant +// of patent rights can be found in the PATENTS file in the same directory. + +#define LOG_WITH_GLOG +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace devmand { +namespace test { +namespace cli { + +using namespace devmand::channels::cli; +using namespace devmand::cartography; +using namespace devmand::devices; +using namespace devmand::devices::cli; +using namespace devmand::test::utils::cli; +using namespace std; +using namespace folly; +using namespace devmand::test::utils::ssh; +using devmand::channels::cli::IoConfigurationBuilder; +using devmand::channels::cli::ReadCachingCli; +using namespace std::chrono; + +class CliTest : public ::testing::Test { + protected: + shared_ptr ssh; + unique_ptr cliEngine; + + void SetUp() override { + devmand::test::utils::log::initLog(MDEBUG); + cliEngine = make_unique(); + ssh = startSshServer(); + } + + void TearDown() override { + ssh->close(); + } +}; + +static std::function ensureConnected(const shared_ptr& cli) { + return [cli]() { + try { + cli->executeRead(ReadCommand::create("echo 123", true)).get(); + return true; + } catch (const exception& e) { + return false; + } + }; +} + +TEST_F(CliTest, writeMultipleTimesAllExecute) { + cartography::DeviceConfig deviceConfig; + devmand::cartography::ChannelConfig chnlCfg; + std::map kvPairs; + kvPairs.insert(std::make_pair("port", "9999")); + kvPairs.insert(std::make_pair("username", "root")); + kvPairs.insert(std::make_pair("password", "root")); + chnlCfg.kvPairs = kvPairs; + deviceConfig.channelConfigs.insert(std::make_pair("cli", chnlCfg)); + deviceConfig.ip = "localhost"; + deviceConfig.id = "localhost-test-device"; + + IoConfigurationBuilder ioConfigurationBuilder(deviceConfig, *cliEngine); + const shared_ptr& cli = + ioConfigurationBuilder.createAll(ReadCachingCli::createCache()); + const function &connectionTest = ensureConnected(cli); + + EXPECT_BECOMES_TRUE(connectionTest()); + + cli->executeWrite(WriteCommand::create("sleep 2\nsleep2")).get(); + steady_clock::time_point begin = steady_clock::now(); + cli->executeWrite(WriteCommand::create("sleep 2")).get(); + steady_clock::time_point end = steady_clock::now(); + EXPECT_GE(duration_cast(end - begin).count(), 2000); +} + +} // namespace cli +} // namespace test +} // namespace devmand diff --git a/docs/readmes/orc8r/deploy_build.md b/docs/readmes/orc8r/deploy_build.md index 5eec92cac2e4..20565520c214 100644 --- a/docs/readmes/orc8r/deploy_build.md +++ b/docs/readmes/orc8r/deploy_build.md @@ -22,7 +22,7 @@ When this job finishes, upload these images to your image registry: ```bash export MAGMA_TAG=v1.0.0 -for image in proxy controller prometheus-cache config-manager grafana +for image in proxy controller prometheus-cache alertmanager-configurer prometheus-configurer grafana do ../../../orc8r/tools/docker/publish.sh -r REGISTRY -i ${image} -v ${MAGMA_TAG} done diff --git a/docs/readmes/orc8r/deploy_install.md b/docs/readmes/orc8r/deploy_install.md index 9302e9c36c07..ceeffe94533f 100644 --- a/docs/readmes/orc8r/deploy_install.md +++ b/docs/readmes/orc8r/deploy_install.md @@ -172,8 +172,8 @@ prometheusPushAddresses: - "http://orc8r-prometheus-cache:9091/metrics" alertmanagerApiURL: "http://orc8r-alertmanager:9093/api/v2/alerts" -prometheusConfigServiceURL: "http://orc8r-config-manager:9100" -alertmanagerConfigServiceURL: "http://orc8r-config-manager:9101" +prometheusConfigServiceURL: "http://orc8r-prometheus-configurer:9100" +alertmanagerConfigServiceURL: "http://orc8r-alertmanager-configurer:9101" ``` ## Initial Helm Deploy @@ -265,10 +265,18 @@ metrics: nodeSelector: worker-type: metrics - configmanager: + alertmanagerConfigurer: create: true image: - repository: YOUR-DOCKER-REGISTRY/config-manager + repository: YOUR-DOCKER-REGISTRY/alertmanager-configurer + tag: YOUR-CONTAINER-TAG + nodeSelector: + worker-type: metrics + + prometheusConfigurer: + create: true + image: + repository: YOUR-DOCKER-REGISTRY/prometheus-configurer tag: YOUR-CONTAINER-TAG nodeSelector: worker-type: metrics @@ -350,16 +358,17 @@ First, find a `orc8r-controller-` pod in k8s: ```bash $ kubectl -n magma get pods -NAME READY STATUS RESTARTS AGE -orc8r-configmanager-896d784bc-chqr7 1/1 Running 0 X -orc8r-controller-7757567bf5-cm4wn 1/1 Running 0 X -orc8r-controller-7757567bf5-jshpv 1/1 Running 0 X -orc8r-alertmanager-c8dc7cdb5-crzpl 1/1 Running 0 X -orc8r-grafana-6446b97885-ck6g8 1/1 Running 0 X -orc8r-prometheus-6c67bcc9d8-6lx22 1/1 Running 0 X -orc8r-prometheus-cache-6bf7648446-9t9hx 1/1 Running 0 X -orc8r-proxy-57cf989fcc-cg54z 1/1 Running 0 X -orc8r-proxy-57cf989fcc-xn2cw 1/1 Running 0 X +NAME READY STATUS RESTARTS AGE +orc8r-alertmanager-configurer-c8dc7cdb5-crzpl 1/1 Running 0 X +orc8r-controller-7757567bf5-cm4wn 1/1 Running 0 X +orc8r-controller-7757567bf5-jshpv 1/1 Running 0 X +orc8r-alertmanager-c8dc7cdb5-crzpl 1/1 Running 0 X +orc8r-grafana-6446b97885-ck6g8 1/1 Running 0 X +orc8r-prometheus-6c67bcc9d8-6lx22 1/1 Running 0 X +orc8r-prometheus-cache-6bf7648446-9t9hx 1/1 Running 0 X +orc8r-prometheus-configurer-896d784bc-chqr7 1/1 Running 0 X +orc8r-proxy-57cf989fcc-cg54z 1/1 Running 0 X +orc8r-proxy-57cf989fcc-xn2cw 1/1 Running 0 X ``` Then: diff --git a/feg/gateway/diameter/definitions.go b/feg/gateway/diameter/definitions.go index 52653ea5f32b..a13a97f03ef8 100644 --- a/feg/gateway/diameter/definitions.go +++ b/feg/gateway/diameter/definitions.go @@ -10,9 +10,10 @@ package diameter const ( // SuccessCode is the result code returned from a successful diameter call - SuccessCode = 2001 - LimitedSuccessCode = 2002 - DiameterRatingFailed = 5031 + SuccessCode = 2001 + LimitedSuccessCode = 2002 + DiameterRatingFailed = 5031 + DiameterCreditLimitReached = 4012 ) var diamCodeToNameMap = map[uint32]string{ diff --git a/feg/gateway/go.mod b/feg/gateway/go.mod index 7680044dc2d4..fa31a0881538 100644 --- a/feg/gateway/go.mod +++ b/feg/gateway/go.mod @@ -7,6 +7,8 @@ module magma/feg/gateway replace ( + github.com/fiorix/go-diameter/v4 => github.com/emakeev/go-diameter/v4 v4.0.2 + magma/feg/cloud/go => ../../feg/cloud/go magma/feg/cloud/go/protos => ../../feg/cloud/go/protos @@ -16,7 +18,7 @@ replace ( ) require ( - github.com/fiorix/go-diameter/v4 v4.0.1-0.20200102140015-a6c006d17e34 + github.com/fiorix/go-diameter/v4 v4.0.1 github.com/go-redis/redis v6.14.1+incompatible github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b github.com/golang/protobuf v1.3.2 diff --git a/feg/gateway/go.sum b/feg/gateway/go.sum index 9e4ff33f4c5b..8329c9024c87 100644 --- a/feg/gateway/go.sum +++ b/feg/gateway/go.sum @@ -3,9 +3,11 @@ cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/Azure/azure-sdk-for-go v0.0.0-20161028183111-bd73d950fa44/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/Masterminds/squirrel v1.1.1-0.20190513200039-d13326f0be73 h1:+cRmVBz3H/U19fwW85uY+vS+EweAj7cPdhlP4b7vrE4= github.com/Masterminds/squirrel v1.1.1-0.20190513200039-d13326f0be73/go.mod h1:yaPeOnPG5ZRwL9oKdTsO/prlkPbXWZlRVMQ/gGlzIuA= +github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -13,6 +15,7 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY= github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= @@ -34,6 +37,7 @@ github.com/cenkalti/backoff v0.0.0-20181003080854-62661b46c409/go.mod h1:90ReRw6 github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/certifi/gocertifi v0.0.0-20180905225744-ee1a9a0726d2/go.mod h1:GJKEexRPVJrBSOjoqN5VNOIKJ5Q3RViH6eu3puDRwx4= github.com/cespare/xxhash v0.0.0-20181017004759-096ff4a8a059/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= @@ -50,6 +54,7 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dgrijalva/jwt-go v0.0.0-20161101193935-9ed569b5d1ac/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +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/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -59,17 +64,17 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/elastic/gosigar v0.9.0/go.mod h1:cdorVVzy1fhmEqmtgqkoE3bYtCfSCkVyjTyCIo22xvs= github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= +github.com/emakeev/go-diameter/v4 v4.0.2 h1:QMgoZhQVLGBgmgu4DAR7AcesNMerH/3GTiJdzZw8ey0= +github.com/emakeev/go-diameter/v4 v4.0.2/go.mod h1:Qx/+pf+c9sBUHWq1d7EH3bkdwN8U0mUpdy9BieDw6UQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a/go.mod h1:7Ga40egUymuWXxAe151lTNnCv97MddSOVsjpPPkityA= github.com/facebookincubator/ent v0.0.0-20191128071424-29c7b0a0d805 h1:Gqrw3IfjWQ1afKMX8OuKq3vTnjhccK0Apllv8qrLdfI= github.com/facebookincubator/ent v0.0.0-20191128071424-29c7b0a0d805/go.mod h1:3CGvz1m+D78JUti7JFkY6AkKj88McWuT80UcamLqEJQ= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fiorix/go-diameter v3.0.2+incompatible h1:PLk2NkqMYILlEdeiz0hJVB3xcuuL+Gc9iCaEgjfbs5w= -github.com/fiorix/go-diameter/v4 v4.0.1-0.20200102140015-a6c006d17e34 h1:rj7Jhd1mw5O2wxoDZmEbRj7qVUIlxi0jQiU/qm0qpvo= -github.com/fiorix/go-diameter/v4 v4.0.1-0.20200102140015-a6c006d17e34/go.mod h1:Qx/+pf+c9sBUHWq1d7EH3bkdwN8U0mUpdy9BieDw6UQ= -github.com/fiorix/go-diameter/v4 v4.0.1 h1:IEjXnzKDej/a1Z703XGfFbgvengXIBLuWLvAGWv+ZK8= +github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= +github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/getsentry/raven-go v0.1.0/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -78,9 +83,12 @@ github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8 h1:DujepqpGd1hyOd7a 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-ini/ini v1.21.1/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= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -127,6 +135,7 @@ github.com/go-redis/redis v6.14.1+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8w github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.1-0.20190510102335-877a9775f068 h1:q2kwd9Bcgl2QpSi/Wjcx9jzwyICt3EWTP5to43QhwaA= github.com/go-sql-driver/mysql v1.4.1-0.20190510102335-877a9775f068/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-swagger/go-swagger v0.18.0/go.mod h1:fOcXeMI1KPNv3uk4u7cR4VSyq0NyrYx4SS1/ajuTWDg= github.com/go-swagger/scan-repo-boundary v0.0.0-20180623220736-973b3573c013/go.mod h1:b65mBPzqzZWxOZGxSWrqs4GInLIn+u99Q9q7p+GKni0= @@ -150,6 +159,7 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l github.com/google/btree v0.0.0-20180124185431-e89373fe6b4a/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/gofuzz v0.0.0-20150304233714-bbcb9da2d746/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/pprof v0.0.0-20180605153948-8b03ce837f34/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -160,6 +170,7 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gnostic v0.0.0-20180520015035-48a0ecefe2e4/go.mod h1:sJBsCZ4ayReDTBIg8b9dl28c5xFWyhBTVRp3pOg5EKY= github.com/gophercloud/gophercloud v0.0.0-20170607034829-caf34a65f602/go.mod h1:3WdhXV3rUYy9p6AUW8d94kr+HS62Y4VL9mBnFxsD8q4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/handlers v1.4.0/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= @@ -187,6 +198,7 @@ github.com/hashicorp/memberlist v0.1.0/go.mod h1:ncdBp14cuox2iFOq3kDiquKU6fqsTBc github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.0.0-20161007004122-1d4fa605f6ff/go.mod h1:h/Ru6tmZazX7WO/GDmwdpS975F019L4t5ng5IgwbNrE= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= +github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb v0.0.0-20170331210902-15e594fc09f1/go.mod h1:qZna6X/4elxqT3yI9iZYdZrWWdeFOOprn86kgg4+IzY= @@ -208,9 +220,12 @@ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQL github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/knz/strtime v0.0.0-20181018220328-af2256ee352c/go.mod h1:4ZxfWkxwtc7dBeifERVVWRy9F9rTU9p0yCDgeCtlius= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kylelemons/godebug v0.0.0-20160406211939-eadb3ce320cb/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/labstack/echo v0.0.0-20181123063414-c54d9e8eed6c h1:RJpEpNeljivHmL1Q5DB2QBoGbnBXY18rZshzbHxMCFo= @@ -254,25 +269,31 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +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/oklog/oklog v0.0.0-20170918173356-f857583a70c3/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= 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= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.1/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olivere/elastic/v7 v7.0.6 h1:BIzjaAYGL8Ur1pIPIpiYDvly4HkHrO/uakiV22WDEQQ= github.com/olivere/elastic/v7 v7.0.6/go.mod h1:nut831m8vw5KQbQxX1oXjj3/buiDpDZc5pqNVdH9xYk= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opentracing-contrib/go-stdlib v0.0.0-20170113013457-1de4cc2120e7/go.mod h1:PLldrQSroqzH70Xl+1DQcGnefIbqsKR7UDaiux3zV+w= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.1/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= +github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/peterbourgon/diskv v0.0.0-20180312054125-0646ccaebea1/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= @@ -285,6 +306,7 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/prometheus/alertmanager v0.17.0 h1:h4EqB7nSCb0zNl8prrb9kX9nO2ZQh//aQkCiemLCw3Q= github.com/prometheus/alertmanager v0.17.0/go.mod h1:3/vUuD9sDlkVuB2KLczjrlG7aqT09pyK0jfTp/itWS0= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM= @@ -304,7 +326,9 @@ github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1 h1:/K3IL0Z1quvmJ7X0A1AwNEK7CRkVK3YwfOU/QAL4WGg= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/prometheus v0.0.0-20180315085919-58e2a31db8de/go.mod h1:oAIUtOny2rjMX0OWN5vPR5/q/twIROJvdqnQKDdil/s= +github.com/prometheus/prometheus v0.0.0-20190115164134-b639fe140c1f h1:aby0Eo+MzbS26Y9XWpoTL2vW7dHRUq6OZz3SKJXNzu4= github.com/prometheus/prometheus v0.0.0-20190115164134-b639fe140c1f/go.mod h1:oc9yTe7NgloOQAsZTBCwrl1ioT840vwF9yZpIvLKKmQ= +github.com/prometheus/tsdb v0.3.1 h1:uGgfubT2MesNpx3T46c5R32RcUoKAPGyWX+4x1orJLE= github.com/prometheus/tsdb v0.3.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rlmcpherson/s3gof3r v0.5.0/go.mod h1:s7vv7SMDPInkitQMuZzH615G7yWHdrU2r/Go7Bo71Rs= @@ -326,6 +350,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/smartystreets/goconvey v0.0.0-20180222194500-ef6db91d284a/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= @@ -390,6 +415,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58 h1:8gQV6CLnAEikrhgkHFbMAEhagSSnXWGV915qUMm9mrU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -427,6 +453,7 @@ google.golang.org/api v0.0.0-20180506000402-20530fd5d65a/go.mod h1:4mhQ8q/RsB7i+ google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/appengine v0.0.0-20170522224838-a2f4131514e5/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/cloud v0.0.0-20160622021550-0a83eba2cadb/go.mod h1:0H1ncTHf11KCFhTc/+EFRbzSCOZx+VUbRMk55Yv5MYk= google.golang.org/genproto v0.0.0-20170531203552-aa2eb687b4d3/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= @@ -443,13 +470,17 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.0 h1:ItERT+UbGdX+s4u+nQNlVM/Q7cbmf7icKfvzbWqVtq0= google.golang.org/grpc v1.25.0/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 h1:FVCohIoYO7IJoDDVpV2pdq7SgrMH6wHnuTyrdrxJNoY= gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0/go.mod h1:OdE7CF6DbADk7lN8LIKRzRJTTZXIjtWgA5THM5lhBAw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/fsnotify/fsnotify.v1 v1.3.0/go.mod h1:Fyux9zXlo4rWoMSIzpn9fDAYjalPqJ/K1qJ27s+7ltE= gopkg.in/inf.v0 v0.9.0/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/vmihailenco/msgpack.v2 v2.9.1/go.mod h1:/3Dn1Npt9+MYyLpYYXjInO/5jvMLamn+AEGwNEOatn8= gopkg.in/yaml.v2 v2.2.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/feg/gateway/services/aaa/servicers/responders.go b/feg/gateway/services/aaa/servicers/responders.go index 797ebb854b1d..3813de6ff54d 100644 --- a/feg/gateway/services/aaa/servicers/responders.go +++ b/feg/gateway/services/aaa/servicers/responders.go @@ -10,6 +10,9 @@ LICENSE file in the root directory of this source tree. package servicers import ( + "fmt" + "log" + "magma/feg/gateway/services/aaa/metrics" "magma/orc8r/gateway/directoryd" @@ -44,11 +47,17 @@ func (srv *accountingService) AbortSession( } sid := srv.sessions.FindSession(imsi) if len(sid) == 0 { - return res, Errorf(codes.NotFound, "Session for IMSI: %s is not found", imsi) + res.Code = lteprotos.AbortSessionResult_USER_NOT_FOUND + res.ErrorMessage = fmt.Sprintf("Session for IMSI: %s is not found", imsi) + log.Print(res.ErrorMessage) + return res, nil } s := srv.sessions.GetSession(sid) if s == nil { - return res, Errorf(codes.Internal, "Session for RadSID: %s and IMSI: %s is not found", sid, imsi) + res.Code = lteprotos.AbortSessionResult_SESSION_NOT_FOUND + res.ErrorMessage = fmt.Sprintf("Session for Radius Session ID: %s and IMSI: %s is not found", sid, imsi) + log.Print(res.ErrorMessage) + return res, nil } s.Lock() sctx := proto.Clone(s.GetCtx()).(*protos.Context) @@ -57,9 +66,13 @@ func (srv *accountingService) AbortSession( if len(req.GetSessionId()) > 0 && len(asid) > 0 && asid != req.GetSessionId() { - return res, Errorf(codes.FailedPrecondition, + + res.Code = lteprotos.AbortSessionResult_SESSION_NOT_FOUND + res.ErrorMessage = fmt.Sprintf( "Accounting Session ID Mismatch for RadSID %s and IMSI: %s. Requested: %s, recorded: %s", sid, imsi, req.GetSessionId(), asid) + log.Print(res.ErrorMessage) + return res, nil } if srv.config.GetAccountingEnabled() { // ? can potentially end a new, valid session @@ -74,7 +87,6 @@ func (srv *accountingService) AbortSession( Id: imsi, } directoryd.DeleteRecord(deleteRequest) - } srv.sessions.RemoveSession(sid) conn, err := registry.GetConnection(registry.RADIUS) @@ -84,7 +96,11 @@ func (srv *accountingService) AbortSession( radcli := protos.NewAuthorizationClient(conn) _, err = radcli.Disconnect(ctx, &protos.DisconnectRequest{Ctx: sctx}) if err != nil { - err = Error(codes.Internal, err) + res.Code = lteprotos.AbortSessionResult_RADIUS_SERVER_ERROR + res.ErrorMessage = fmt.Sprintf( + "Radius Disconnect Error: %v for IMSI: %s, Acct SID: %s, Radius SID: %s", err, imsi, asid, sid) + log.Print(res.ErrorMessage) + return res, nil } return res, err } diff --git a/feg/gateway/services/session_proxy/credit_control/asr.go b/feg/gateway/services/session_proxy/credit_control/asr.go index b4218c4bb9c4..bbaf9d30f1da 100644 --- a/feg/gateway/services/session_proxy/credit_control/asr.go +++ b/feg/gateway/services/session_proxy/credit_control/asr.go @@ -79,8 +79,13 @@ func (h *asrHandler) ServeDIAM(conn diam.Conn, m *diam.Message) { case protos.AbortSessionResult_USER_NOT_FOUND: glog.Errorf("Unknown User in ASR: %s", res.GetErrorMessage()) resCode = diam.UnknownUser - default: + case protos.AbortSessionResult_SESSION_REMOVED: resCode = diam.Success + default: + if len(res.GetErrorMessage()) > 0 { + glog.Errorf("Limited ASR Success: %s", res.GetErrorMessage()) + } + resCode = diam.LimitedSuccess } h.sendASA(conn, m, asr.SessionID, resCode) }() diff --git a/feg/gateway/services/session_proxy/servicers/credits.go b/feg/gateway/services/session_proxy/servicers/credits.go index 32498786fec6..bdf97217639e 100644 --- a/feg/gateway/services/session_proxy/servicers/credits.go +++ b/feg/gateway/services/session_proxy/servicers/credits.go @@ -373,3 +373,29 @@ func getTerminateRequestFromUsage(termination *protos.SessionTerminateRequest) * RatType: gy.GetRATType(termination.GetRatType()), } } + +func validateGyCCAIMSCC(gyCCAInit *gy.CreditControlAnswer) error { + /* Here we need to go through the result codes within MSCC received */ + + for _, credit := range gyCCAInit.Credits { + switch credit.ResultCode { + case diameter.SuccessCode: + { + glog.V(2).Infof("MSCC Avp Result code %v for Rating group %v", + credit.ResultCode, credit.RatingGroup) + } + case diameter.DiameterCreditLimitReached: + { + glog.V(2).Infof("MSCC Avp Result code %v for Rating group %v. Subscriber out of credit on OCS", + credit.ResultCode, credit.RatingGroup) + } + default: + { + return fmt.Errorf( + "Received unsuccessful result code from OCS, ResultCode: %d, Rating Group: %d", + credit.ResultCode, credit.RatingGroup) + } + } + } + return nil +} diff --git a/feg/gateway/services/session_proxy/servicers/session_controller.go b/feg/gateway/services/session_proxy/servicers/session_controller.go index 6bb5649fcf56..03f7abc2bcca 100644 --- a/feg/gateway/services/session_proxy/servicers/session_controller.go +++ b/feg/gateway/services/session_proxy/servicers/session_controller.go @@ -97,10 +97,6 @@ func (srv *CentralSessionController) CreateSession( dynamicRuleDefs = append(dynamicRuleDefs, rule.RuleDefinitions...) } - if srv.cfg.UseGyForAuthOnly { - return srv.handleUseGyForAuthOnly(imsi, request, gxCCAInit) - } - policyRules := getPolicyRulesFromDefinitions(dynamicRuleDefs) keys, err := srv.dbClient.GetChargingKeysForRules(staticRuleNames, policyRules) if err != nil { @@ -108,6 +104,10 @@ func (srv *CentralSessionController) CreateSession( return nil, err } keys = removeDuplicateChargingKeys(keys) + + if srv.cfg.UseGyForAuthOnly { + return srv.handleUseGyForAuthOnly(imsi, request, gxCCAInit) + } credits := []*protos.CreditUpdateResponse{} if len(keys) > 0 { @@ -154,7 +154,7 @@ func (srv *CentralSessionController) handleUseGyForAuthOnly( gxCCAInit *gx.CreditControlAnswer, ) (*protos.CreateSessionResponse, error) { gyCCRInit := getCCRInitRequest(imsi, pReq) - _, err := srv.sendSingleCreditRequest(gyCCRInit) + gyCCAInit, err := srv.sendSingleCreditRequest(gyCCRInit) metrics.UpdateGyRecentRequestMetrics(err) if err != nil { metrics.OcsCcrInitSendFailures.Inc() @@ -163,6 +163,12 @@ func (srv *CentralSessionController) handleUseGyForAuthOnly( } metrics.OcsCcrInitRequests.Inc() + err = validateGyCCAIMSCC(gyCCAInit) + if err != nil { + glog.Errorf("MSCC Avp Failure: %s", err) + return nil, err + } + staticRules, dynamicRules := gx.ParseRuleInstallAVPs( srv.dbClient, gxCCAInit.RuleInstallAVP, diff --git a/feg/gateway/services/session_proxy/servicers/session_controller_test.go b/feg/gateway/services/session_proxy/servicers/session_controller_test.go index 5f4dd2e322a3..85a88404d47f 100644 --- a/feg/gateway/services/session_proxy/servicers/session_controller_test.go +++ b/feg/gateway/services/session_proxy/servicers/session_controller_test.go @@ -1216,3 +1216,150 @@ func returnGySuccessNoRatingGroup(args mock.Arguments) { Credits: credits, } } + +func TestSessionControllerUseGyForAuthOnlyCreditLimitReached(t *testing.T) { + mocks := &sessionMocks{ + gy: &MockCreditClient{}, + gx: &MockPolicyClient{}, + policydb: &MockPolicyDBClient{}, + } + + // Send back DIAMETER_SUCCESS (2001) from gx + mocks.gx.On("SendCreditControlRequest", mock.Anything, mock.Anything, mock.Anything).Return(nil).Run(func(args mock.Arguments) { + done := args.Get(1).(chan interface{}) + request := args.Get(2).(*gx.CreditControlRequest) + + ruleInstalls := []*gx.RuleInstallAVP{ + &gx.RuleInstallAVP{ + RuleNames: []string{"static_rule_1"}, + RuleDefinitions: []*gx.RuleDefinition{}, + }, + } + + done <- &gx.CreditControlAnswer{ + ResultCode: uint32(diameter.SuccessCode), + SessionID: request.SessionID, + RequestNumber: request.RequestNumber, + RuleInstallAVP: ruleInstalls, + } + }).Once() + mocks.policydb.On("GetChargingKeysForRules", mock.Anything, mock.Anything).Return( + []policydb.ChargingKey{}, nil).Once() + + // Even if there are no rating groups, gy CCR-I will be called. + mocks.gy.On( + "SendCreditControlRequest", + mock.Anything, + mock.Anything, + mock.MatchedBy(getGyCCRMatcher(credit_control.CRTInit)), + ).Return(nil).Run(returnGySuccessCreditLimitReached).Once() + + cfg := getTestConfig(gy.PerKeyInit) + cfg.UseGyForAuthOnly = true + srv := servicers.NewCentralSessionController( + mocks.gy, + mocks.gx, + mocks.policydb, + cfg, + ) + ctx := context.Background() + _, err := srv.CreateSession(ctx, &protos.CreateSessionRequest{ + Subscriber: &protos.SubscriberID{ + Id: IMSI1, + }, + SessionId: "00101-1234", + }) + mocks.gx.AssertExpectations(t) + assert.NoError(t, err) +} + +func returnGySuccessCreditLimitReached(args mock.Arguments) { + done := args.Get(1).(chan interface{}) + request := args.Get(2).(*gy.CreditControlRequest) + credits := []*gy.ReceivedCredits{ + &gy.ReceivedCredits{ + ResultCode: diameter.DiameterCreditLimitReached, + }, + } + + done <- &gy.CreditControlAnswer{ + ResultCode: uint32(diameter.SuccessCode), + SessionID: request.SessionID, + RequestNumber: request.RequestNumber, + Credits: credits, + } +} + +func TestSessionControllerUseGyForAuthOnlySubscriberBarred(t *testing.T) { + mocks := &sessionMocks{ + gy: &MockCreditClient{}, + gx: &MockPolicyClient{}, + policydb: &MockPolicyDBClient{}, + } + + // Send back DIAMETER_SUCCESS (2001) from gx + mocks.gx.On("SendCreditControlRequest", mock.Anything, mock.Anything, mock.Anything).Return(nil).Run(func(args mock.Arguments) { + done := args.Get(1).(chan interface{}) + request := args.Get(2).(*gx.CreditControlRequest) + + ruleInstalls := []*gx.RuleInstallAVP{ + &gx.RuleInstallAVP{ + RuleNames: []string{"static_rule_1"}, + RuleDefinitions: []*gx.RuleDefinition{}, + }, + } + + done <- &gx.CreditControlAnswer{ + ResultCode: uint32(diameter.SuccessCode), + SessionID: request.SessionID, + RequestNumber: request.RequestNumber, + RuleInstallAVP: ruleInstalls, + } + }).Once() + mocks.policydb.On("GetChargingKeysForRules", mock.Anything, mock.Anything).Return( + []policydb.ChargingKey{}, nil).Once() + + // Even if there are no rating groups, gy CCR-I will be called. + mocks.gy.On( + "SendCreditControlRequest", + mock.Anything, + mock.Anything, + mock.MatchedBy(getGyCCRMatcher(credit_control.CRTInit)), + ).Return(nil).Run(returnGySuccessSubscriberBarred).Once() + + cfg := getTestConfig(gy.PerKeyInit) + cfg.UseGyForAuthOnly = true + srv := servicers.NewCentralSessionController( + mocks.gy, + mocks.gx, + mocks.policydb, + cfg, + ) + ctx := context.Background() + _, err := srv.CreateSession(ctx, &protos.CreateSessionRequest{ + Subscriber: &protos.SubscriberID{ + Id: IMSI1, + }, + SessionId: "00101-1234", + }) + mocks.gx.AssertExpectations(t) + assert.Error(t, err) +} + +func returnGySuccessSubscriberBarred(args mock.Arguments) { + done := args.Get(1).(chan interface{}) + request := args.Get(2).(*gy.CreditControlRequest) + credits := []*gy.ReceivedCredits{ + &gy.ReceivedCredits{ + ResultCode: diameter.DiameterRatingFailed, + }, + } + + done <- &gy.CreditControlAnswer{ + ResultCode: uint32(diameter.SuccessCode), + SessionID: request.SessionID, + RequestNumber: request.RequestNumber, + Credits: credits, + } +} + diff --git a/feg/gateway/services/testcore/hss/servicers/hss_swx_proxy_integration_test.go b/feg/gateway/services/testcore/hss/servicers/hss_swx_proxy_integration_test.go index 975ffd225752..3d2451bc4ab8 100644 --- a/feg/gateway/services/testcore/hss/servicers/hss_swx_proxy_integration_test.go +++ b/feg/gateway/services/testcore/hss/servicers/hss_swx_proxy_integration_test.go @@ -24,12 +24,22 @@ import ( ) func TestMAR_Successful(t *testing.T) { - testMARSuccessful(t, true) - testMARSuccessful(t, false) + testMARSuccessful(t, true, false) + testMARSuccessful(t, false, false) + testMARSuccessful(t, true, true) + testMARSuccessful(t, false, true) } -func testMARSuccessful(t *testing.T, verifyAuthorization bool) { +func testMARSuccessful(t *testing.T, verifyAuthorization bool, clearAAAserver bool) { hss := getTestHSSDiameterServer(t) + subscriber, err := hss.GetSubscriberData(context.Background(), <eprotos.SubscriberID{Id: "sub1"}) + assert.NoError(t, err) + if clearAAAserver { + subscriber.State.TgppAaaServerName = "" + } + _, err = hss.UpdateSubscriber(context.Background(), subscriber) + assert.NoError(t, err) + swxProxy := getTestSwxProxy(t, hss, verifyAuthorization, false, true) mar := &fegprotos.AuthenticationRequest{ UserName: "sub1", diff --git a/feg/gateway/services/testcore/hss/servicers/sa.go b/feg/gateway/services/testcore/hss/servicers/sa.go index acc4c454b5c5..30fae097d373 100644 --- a/feg/gateway/services/testcore/hss/servicers/sa.go +++ b/feg/gateway/services/testcore/hss/servicers/sa.go @@ -66,9 +66,18 @@ func NewSAA(srv *HomeSubscriberServer, msg *diam.Message) (*diam.Message, error) } answer := ConstructSuccessAnswer(msg, sar.SessionID, srv.Config.Server, diam.TGPP_SWX_APP_ID) - answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer) answer.NewAVP(avp.UserName, avp.Mbit, 0, sar.UserName) + switch sar.ServerAssignmentType { + case servicers.ServerAssignnmentType_USER_DEREGISTRATION: + subscriber.State.TgppAaaServerName = "" + subscriber.State.TgppAaaServerRegistered = false + err = srv.store.UpdateSubscriber(subscriber) + if err != nil { + err = fmt.Errorf("Failed to deregister 3GPP AAA server: %v", err) + return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err + } + case servicers.ServerAssignmentType_REGISTRATION: subscriber.State.TgppAaaServerRegistered = true err = srv.store.UpdateSubscriber(subscriber) @@ -76,9 +85,13 @@ func NewSAA(srv *HomeSubscriberServer, msg *diam.Message) (*diam.Message, error) err = fmt.Errorf("Failed to register 3GPP AAA server: %v", err) return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err } - fallthrough + answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer) + answer.AddAVP(getNon3GPPUserDataAVP(subscriber.GetNon_3Gpp())) + case servicers.ServerAssignmentType_AAA_USER_DATA_REQUEST: + answer.NewAVP(avp.TGPPAAAServerName, avp.Mbit|avp.Vbit, diameter.Vendor3GPP, aaaServer) answer.AddAVP(getNon3GPPUserDataAVP(subscriber.GetNon_3Gpp())) + default: err = fmt.Errorf("server assignment type not implemented: %v", sar.ServerAssignmentType) return ConstructFailureAnswer(msg, sar.SessionID, srv.Config.Server, uint32(diam.UnableToComply)), err diff --git a/feg/gateway/services/testcore/hss/servicers/sa_test.go b/feg/gateway/services/testcore/hss/servicers/sa_test.go index e1d8ce2b5603..e9a6fc5f0ab0 100644 --- a/feg/gateway/services/testcore/hss/servicers/sa_test.go +++ b/feg/gateway/services/testcore/hss/servicers/sa_test.go @@ -39,6 +39,19 @@ func TestNewSAA_SuccessfulRegistration(t *testing.T) { assert.True(t, subscriber.GetState().GetTgppAaaServerRegistered()) } +func TestNewSAA_SuccessfulDeregistration(t *testing.T) { + sar := createSAR("sub1", definitions.ServerAssignnmentType_USER_DEREGISTRATION) + server := test.NewTestHomeSubscriberServer(t) + response, err := hss.NewSAA(server, sar) + assert.NoError(t, err) + checkSAASuccessDeregistration(t, response) + + subscriber, err := server.GetSubscriberData(context.Background(), <eprotos.SubscriberID{Id: "sub1"}) + assert.NoError(t, err) + assert.False(t, subscriber.GetState().GetTgppAaaServerRegistered()) + assert.Empty(t, subscriber.GetState().TgppAaaServerName) +} + func TestNewSAA_SuccessfulUserDataRequest(t *testing.T) { sar := createSAR("sub1", definitions.ServerAssignmentType_AAA_USER_DATA_REQUEST) server := test.NewTestHomeSubscriberServer(t) @@ -167,6 +180,16 @@ func checkSAASuccess(t *testing.T, response *diam.Message) { assert.Equal(t, datatype.UTF8String("12345"), profile.SubscriptionId.SubscriptionIdData) } +// checkSAASuccessDeregistration ensures that a successful SAA with a deregistration command contains all the expected data +func checkSAASuccessDeregistration(t *testing.T, response *diam.Message) { + saa := testUnmarshalSAA(t, response) + assert.Equal(t, diam.Success, int(saa.ResultCode)) + assert.Equal(t, datatype.DiameterIdentity(""), saa.AAAServerName) + assert.Equal(t, datatype.UTF8String("sub1"), saa.UserName) + assert.Equal(t, int32(definitions.AuthSessionState_NO_STATE_MAINTAINED), saa.AuthSessionState) + +} + // testUnmarshalSAA unmarshals an SAA message and checks that the SessionID, // OriginHost, and OriginRealm fields are as expected. func testUnmarshalSAA(t *testing.T, response *diam.Message) definitions.SAA { diff --git a/lte/cloud/go/protos/abort_session.pb.go b/lte/cloud/go/protos/abort_session.pb.go index 90954a27bf8f..3be4539013a0 100644 --- a/lte/cloud/go/protos/abort_session.pb.go +++ b/lte/cloud/go/protos/abort_session.pb.go @@ -27,10 +27,11 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type AbortSessionResult_Code int32 const ( - AbortSessionResult_SESSION_REMOVED AbortSessionResult_Code = 0 - AbortSessionResult_SESSION_NOT_FOUND AbortSessionResult_Code = 1 - AbortSessionResult_USER_NOT_FOUND AbortSessionResult_Code = 2 - AbortSessionResult_GATEWAY_NOT_FOUND AbortSessionResult_Code = 3 + AbortSessionResult_SESSION_REMOVED AbortSessionResult_Code = 0 + AbortSessionResult_SESSION_NOT_FOUND AbortSessionResult_Code = 1 + AbortSessionResult_USER_NOT_FOUND AbortSessionResult_Code = 2 + AbortSessionResult_GATEWAY_NOT_FOUND AbortSessionResult_Code = 3 + AbortSessionResult_RADIUS_SERVER_ERROR AbortSessionResult_Code = 4 ) var AbortSessionResult_Code_name = map[int32]string{ @@ -38,13 +39,15 @@ var AbortSessionResult_Code_name = map[int32]string{ 1: "SESSION_NOT_FOUND", 2: "USER_NOT_FOUND", 3: "GATEWAY_NOT_FOUND", + 4: "RADIUS_SERVER_ERROR", } var AbortSessionResult_Code_value = map[string]int32{ - "SESSION_REMOVED": 0, - "SESSION_NOT_FOUND": 1, - "USER_NOT_FOUND": 2, - "GATEWAY_NOT_FOUND": 3, + "SESSION_REMOVED": 0, + "SESSION_NOT_FOUND": 1, + "USER_NOT_FOUND": 2, + "GATEWAY_NOT_FOUND": 3, + "RADIUS_SERVER_ERROR": 4, } func (x AbortSessionResult_Code) String() string { @@ -158,26 +161,28 @@ func init() { func init() { proto.RegisterFile("lte/protos/abort_session.proto", fileDescriptor_80dacefcd8bf4976) } var fileDescriptor_80dacefcd8bf4976 = []byte{ - // 302 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xdf, 0x4b, 0xfa, 0x50, - 0x14, 0xc0, 0x9d, 0x5f, 0xf9, 0xd2, 0x0e, 0x66, 0x76, 0x44, 0xb0, 0x44, 0x89, 0xf5, 0xd2, 0xd3, - 0x06, 0x06, 0xbd, 0x5b, 0xae, 0xf0, 0xc1, 0x8d, 0x36, 0x2d, 0x0a, 0x62, 0x5c, 0xbd, 0x07, 0x13, - 0x36, 0xaf, 0xdd, 0x7b, 0xf7, 0x7f, 0xf6, 0x27, 0xc5, 0xae, 0x1a, 0xab, 0xa8, 0xa7, 0x0b, 0x9f, - 0xf3, 0x39, 0xe7, 0x9e, 0x1f, 0xd0, 0x4f, 0x35, 0x79, 0x1b, 0x29, 0xb4, 0x50, 0x1e, 0x9b, 0x0b, - 0xa9, 0x13, 0x45, 0x4a, 0xad, 0xc4, 0xda, 0x35, 0x10, 0xed, 0x8c, 0x2d, 0x33, 0xe6, 0xa6, 0x9a, - 0x9c, 0x7b, 0x68, 0x0d, 0x0b, 0x23, 0xde, 0x0a, 0x11, 0xbd, 0xe5, 0xa4, 0x34, 0xf6, 0x00, 0x76, - 0x29, 0xc9, 0x8a, 0x77, 0xac, 0x33, 0xeb, 0xc2, 0x8e, 0xec, 0x1d, 0x19, 0x73, 0xec, 0x82, 0x9d, - 0x2b, 0x92, 0xc9, 0x9a, 0x65, 0xd4, 0xa9, 0x9a, 0xe8, 0x41, 0x01, 0x02, 0x96, 0x91, 0xf3, 0x6e, - 0x01, 0x7e, 0xad, 0xa9, 0xf2, 0x54, 0xe3, 0x15, 0xd4, 0x16, 0x82, 0x93, 0x29, 0xd6, 0x18, 0x38, - 0xee, 0x67, 0x0f, 0xee, 0x4f, 0xd9, 0xbd, 0x11, 0x9c, 0x22, 0xe3, 0xe3, 0x39, 0x1c, 0x92, 0x94, - 0x42, 0x26, 0x19, 0x29, 0xc5, 0x96, 0xfb, 0xff, 0xea, 0x06, 0x4e, 0xb6, 0xcc, 0x79, 0x81, 0x5a, - 0x91, 0x82, 0x2d, 0x38, 0x8a, 0xfd, 0x38, 0x1e, 0x87, 0x41, 0x12, 0xf9, 0x93, 0xf0, 0xc1, 0x1f, - 0x35, 0x2b, 0xd8, 0x86, 0xe3, 0x3d, 0x0c, 0xc2, 0x69, 0x72, 0x1b, 0xce, 0x82, 0x51, 0xd3, 0x42, - 0x84, 0xc6, 0x2c, 0xf6, 0xa3, 0x12, 0xab, 0x16, 0xea, 0xdd, 0x70, 0xea, 0x3f, 0x0e, 0x9f, 0x4a, - 0xf8, 0xdf, 0xe0, 0x15, 0xda, 0xdf, 0x9a, 0xdc, 0x88, 0x35, 0x27, 0x89, 0x21, 0xd4, 0xcb, 0x01, - 0xec, 0xff, 0x3a, 0x96, 0xd9, 0xeb, 0x69, 0xef, 0xcf, 0xb1, 0x9d, 0xca, 0x75, 0xf7, 0xf9, 0xc4, - 0x18, 0x5e, 0x71, 0xc2, 0x45, 0x2a, 0x72, 0xee, 0x2d, 0xc5, 0xee, 0x96, 0xf3, 0xff, 0xe6, 0xbd, - 0xfc, 0x08, 0x00, 0x00, 0xff, 0xff, 0x14, 0x1d, 0x18, 0xf4, 0xe0, 0x01, 0x00, 0x00, + // 321 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0x4d, 0x4f, 0xf2, 0x40, + 0x10, 0x80, 0x29, 0x2f, 0x79, 0x63, 0x27, 0x88, 0xb8, 0x84, 0x88, 0x12, 0x88, 0xa9, 0x17, 0x4f, + 0x6d, 0x82, 0x89, 0xf7, 0x2a, 0xab, 0xe1, 0x40, 0x1b, 0x77, 0x01, 0xa3, 0x97, 0x4d, 0xa1, 0x13, + 0x24, 0x69, 0x59, 0xdc, 0x6d, 0xfd, 0xcf, 0xfe, 0x0b, 0xd3, 0x05, 0x4c, 0xd5, 0xe8, 0x69, 0x93, + 0x67, 0x9e, 0x99, 0x9d, 0x0f, 0xe8, 0x27, 0x19, 0x7a, 0x1b, 0x25, 0x33, 0xa9, 0xbd, 0x68, 0x2e, + 0x55, 0x26, 0x34, 0x6a, 0xbd, 0x92, 0x6b, 0xd7, 0x40, 0x62, 0xa7, 0xd1, 0x32, 0x8d, 0xdc, 0x24, + 0x43, 0xe7, 0x01, 0x5a, 0x7e, 0x61, 0xf0, 0xad, 0xc0, 0xf0, 0x35, 0x47, 0x9d, 0x91, 0x1e, 0xc0, + 0x2e, 0x45, 0xac, 0xe2, 0x8e, 0x75, 0x6e, 0x5d, 0xda, 0xcc, 0xde, 0x91, 0x51, 0x4c, 0xba, 0x60, + 0xe7, 0x1a, 0x95, 0x58, 0x47, 0x29, 0x76, 0xaa, 0x26, 0x7a, 0x50, 0x80, 0x20, 0x4a, 0xd1, 0x79, + 0xb7, 0x80, 0x7c, 0xad, 0xa9, 0xf3, 0x24, 0x23, 0xd7, 0x50, 0x5b, 0xc8, 0x18, 0x4d, 0xb1, 0xc6, + 0xc0, 0x71, 0x3f, 0x7b, 0x70, 0x7f, 0xca, 0xee, 0xad, 0x8c, 0x91, 0x19, 0x9f, 0x5c, 0xc0, 0x21, + 0x2a, 0x25, 0x95, 0x48, 0x51, 0xeb, 0x68, 0xb9, 0xff, 0xaf, 0x6e, 0xe0, 0x78, 0xcb, 0x9c, 0x37, + 0xa8, 0x15, 0x29, 0xa4, 0x05, 0x47, 0x9c, 0x72, 0x3e, 0x0a, 0x03, 0xc1, 0xe8, 0x38, 0x9c, 0xd1, + 0x61, 0xb3, 0x42, 0xda, 0x70, 0xbc, 0x87, 0x41, 0x38, 0x11, 0x77, 0xe1, 0x34, 0x18, 0x36, 0x2d, + 0x42, 0xa0, 0x31, 0xe5, 0x94, 0x95, 0x58, 0xb5, 0x50, 0xef, 0xfd, 0x09, 0x7d, 0xf4, 0x9f, 0x4a, + 0xf8, 0x1f, 0x39, 0x81, 0x16, 0xf3, 0x87, 0xa3, 0x29, 0x17, 0x9c, 0xb2, 0x19, 0x65, 0x82, 0x32, + 0x16, 0xb2, 0x66, 0x6d, 0xf0, 0x02, 0xed, 0x6f, 0xdd, 0x6f, 0xe4, 0x3a, 0x46, 0x45, 0x42, 0xa8, + 0x97, 0x03, 0xa4, 0xff, 0xeb, 0xbc, 0x66, 0xe1, 0x67, 0xbd, 0x3f, 0xf7, 0xe1, 0x54, 0x6e, 0xba, + 0xcf, 0xa7, 0xc6, 0xf0, 0x8a, 0xdb, 0x2e, 0x12, 0x99, 0xc7, 0xde, 0x52, 0xee, 0x8e, 0x3c, 0xff, + 0x6f, 0xde, 0xab, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe7, 0x7f, 0x18, 0x79, 0xf9, 0x01, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/lte/cloud/go/services/cellular/utils/lte_bands.go b/lte/cloud/go/services/cellular/utils/lte_bands.go index dbf7a6f14aef..9cba72eaf583 100644 --- a/lte/cloud/go/services/cellular/utils/lte_bands.go +++ b/lte/cloud/go/services/cellular/utils/lte_bands.go @@ -37,13 +37,29 @@ var bands = [...]LTEBand{ {ID: 4, Mode: FDDMode, StartEarfcnDl: 1950, StartEarfcnUl: 19950, CountEarfcn: 450}, {ID: 28, Mode: FDDMode, StartEarfcnDl: 9210, StartEarfcnUl: 27210, CountEarfcn: 450}, // TDDMode + {ID: 33, Mode: TDDMode, StartEarfcnDl: 36000, CountEarfcn: 200}, + {ID: 34, Mode: TDDMode, StartEarfcnDl: 36200, CountEarfcn: 150}, + {ID: 35, Mode: TDDMode, StartEarfcnDl: 36350, CountEarfcn: 600}, + {ID: 36, Mode: TDDMode, StartEarfcnDl: 36950, CountEarfcn: 600}, + {ID: 37, Mode: TDDMode, StartEarfcnDl: 37550, CountEarfcn: 200}, {ID: 38, Mode: TDDMode, StartEarfcnDl: 37750, CountEarfcn: 500}, {ID: 39, Mode: TDDMode, StartEarfcnDl: 38250, CountEarfcn: 400}, {ID: 40, Mode: TDDMode, StartEarfcnDl: 38650, CountEarfcn: 1000}, {ID: 41, Mode: TDDMode, StartEarfcnDl: 39650, CountEarfcn: 1940}, {ID: 42, Mode: TDDMode, StartEarfcnDl: 41590, CountEarfcn: 2000}, {ID: 43, Mode: TDDMode, StartEarfcnDl: 43590, CountEarfcn: 2000}, + {ID: 44, Mode: TDDMode, StartEarfcnDl: 45590, CountEarfcn: 1000}, + {ID: 45, Mode: TDDMode, StartEarfcnDl: 46590, CountEarfcn: 200}, + {ID: 46, Mode: TDDMode, StartEarfcnDl: 46790, CountEarfcn: 7750}, + {ID: 47, Mode: TDDMode, StartEarfcnDl: 54540, CountEarfcn: 700}, {ID: 48, Mode: TDDMode, StartEarfcnDl: 55240, CountEarfcn: 1500}, + {ID: 49, Mode: TDDMode, StartEarfcnDl: 56740, CountEarfcn: 1500}, + {ID: 50, Mode: TDDMode, StartEarfcnDl: 58240, CountEarfcn: 850}, + {ID: 51, Mode: TDDMode, StartEarfcnDl: 59090, CountEarfcn: 50}, + {ID: 52, Mode: TDDMode, StartEarfcnDl: 59140, CountEarfcn: 1000}, + // Adding Band #53 require changes in the python code cause it's + // start_freq_dl is float value. + //{ID: 53, Mode: TDDMode, StartEarfcnDl: 60140, CountEarfcn: 115}, } // EarfcnDLInRange checks that an EARFCN-DL belongs to a band diff --git a/lte/cloud/go/services/cellular/utils/lte_bands_test.go b/lte/cloud/go/services/cellular/utils/lte_bands_test.go index 2a97f7f340fe..dd00ba93f14c 100644 --- a/lte/cloud/go/services/cellular/utils/lte_bands_test.go +++ b/lte/cloud/go/services/cellular/utils/lte_bands_test.go @@ -35,7 +35,7 @@ func TestGetBand(t *testing.T) { } func TestGetBandError(t *testing.T) { - expectedErr := [...]uint32{45590, 45591} + expectedErr := [...]uint32{60140, 60255} for _, earfcndl := range expectedErr { _, err := utils.GetBand(earfcndl) diff --git a/lte/cloud/go/services/eps_authentication/servicers/test_utils/test_subscribers.go b/lte/cloud/go/services/eps_authentication/servicers/test_utils/test_subscribers.go index f16d801a39f4..568a61c551a9 100644 --- a/lte/cloud/go/services/eps_authentication/servicers/test_utils/test_subscribers.go +++ b/lte/cloud/go/services/eps_authentication/servicers/test_utils/test_subscribers.go @@ -19,13 +19,50 @@ const ( defaultMaxDlBitRate = uint64(200000000) ) -// GetTestSubscribers returns a slice of SubscriberData protos to be used -// for testing authentication. +// GetTestSubscribers returns SubscriberData protos with different settings +// to be used for testing authentication. More users can be added. func GetTestSubscribers() []*protos.SubscriberData { subs := make([]*protos.SubscriberData, 0) + // Default subscriber + sub := generateDefaultSub("sub1") + subs = append(subs, sub) + + // Default Subs with a blank AAA server + sub = generateDefaultSub("sub1_noAAAsrv") + sub.State.TgppAaaServerName = "" + subs = append(subs, sub) + + // Empty sub + sub = &protos.SubscriberData{ + Sid: &protos.SubscriberID{Id: "empty_sub"}, + NetworkId: &orc8rprotos.NetworkID{Id: "test"}, + } + subs = append(subs, sub) + + // Subscriber without auth key + sub = &protos.SubscriberData{ + Sid: &protos.SubscriberID{Id: "missing_auth_key"}, + NetworkId: &orc8rprotos.NetworkID{Id: "test"}, + Lte: &protos.LTESubscription{ + State: protos.LTESubscription_ACTIVE, + AuthAlgo: protos.LTESubscription_MILENAGE, + AuthOpc: []byte("\x8e'\xb6\xaf\x0ei.u\x0f2fz;\x14`]"), + }, + State: &protos.SubscriberState{ + LteAuthNextSeq: 7350, + TgppAaaServerName: defaultServerHost, + }, + } + subs = append(subs, sub) + + return subs +} + +func generateDefaultSub(subscriberID string) *protos.SubscriberData{ + // Default user sub := &protos.SubscriberData{ - Sid: &protos.SubscriberID{Id: "sub1"}, + Sid: &protos.SubscriberID{Id: subscriberID}, NetworkId: &orc8rprotos.NetworkID{Id: "test"}, Lte: &protos.LTESubscription{ State: protos.LTESubscription_ACTIVE, @@ -64,28 +101,6 @@ func GetTestSubscribers() []*protos.SubscriberData { }, SubProfile: "test_profile", } - subs = append(subs, sub) - sub = &protos.SubscriberData{ - Sid: &protos.SubscriberID{Id: "empty_sub"}, - NetworkId: &orc8rprotos.NetworkID{Id: "test"}, - } - subs = append(subs, sub) - - sub = &protos.SubscriberData{ - Sid: &protos.SubscriberID{Id: "missing_auth_key"}, - NetworkId: &orc8rprotos.NetworkID{Id: "test"}, - Lte: &protos.LTESubscription{ - State: protos.LTESubscription_ACTIVE, - AuthAlgo: protos.LTESubscription_MILENAGE, - AuthOpc: []byte("\x8e'\xb6\xaf\x0ei.u\x0f2fz;\x14`]"), - }, - State: &protos.SubscriberState{ - LteAuthNextSeq: 7350, - TgppAaaServerName: defaultServerHost, - }, - } - subs = append(subs, sub) - - return subs + return sub } diff --git a/lte/gateway/c/oai/include/nas_messages_def.h b/lte/gateway/c/oai/include/nas_messages_def.h index 6ddbdf83c71d..56f825b62cb6 100644 --- a/lte/gateway/c/oai/include/nas_messages_def.h +++ b/lte/gateway/c/oai/include/nas_messages_def.h @@ -43,18 +43,3 @@ MESSAGE_DEF( MESSAGE_PRIORITY_MED, itti_nas_auth_param_req_t, nas_auth_param_req) -MESSAGE_DEF( - NAS_EXTENDED_SERVICE_REQ, - MESSAGE_PRIORITY_MED, - itti_nas_extended_service_req_t, - nas_extended_service_req) -MESSAGE_DEF( - NAS_CS_SERVICE_NOTIFICATION, - MESSAGE_PRIORITY_MED, - itti_nas_cs_service_notification_t, - nas_cs_service_notification) -MESSAGE_DEF( - NAS_NOTIFY_SERVICE_REJECT, - MESSAGE_PRIORITY_MED, - itti_nas_notify_service_reject_t, - nas_notify_service_reject) diff --git a/lte/gateway/c/oai/include/nas_messages_types.h b/lte/gateway/c/oai/include/nas_messages_types.h index 7247f86e1f9e..e94025bfbf05 100644 --- a/lte/gateway/c/oai/include/nas_messages_types.h +++ b/lte/gateway/c/oai/include/nas_messages_types.h @@ -49,22 +49,7 @@ #define NAS_AUTHENTICATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_auth_req #define NAS_AUTHENTICATION_PARAM_REQ(mSGpTR) \ (mSGpTR)->ittiMsg.nas_auth_param_req -#define NAS_CS_SERVICE_NOTIFICATION(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_cs_service_notification #define NAS_DATA_LENGHT_MAX 256 -#define NAS_EXTENDED_SERVICE_REQ(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_extended_service_req -#define NAS_NOTIFY_SERVICE_REJECT(mSGpTR) \ - (mSGpTR)->ittiMsg.nas_notify_service_reject - -typedef struct itti_nas_cs_service_notification_s { - mme_ue_s1ap_id_t ue_id; /* UE lower layer identifier */ -#define NAS_PAGING_ID_IMSI 0X00 -#define NAS_PAGING_ID_TMSI 0X01 - uint8_t paging_id; /* Paging UE ID, to be sent in CS Service Notification */ - bstring - cli; /* If CLI received in Sgsap-Paging_Req,shall sent in CS Service Notification */ -} itti_nas_cs_service_notification_t; typedef struct itti_nas_info_transfer_s { mme_ue_s1ap_id_t ue_id; /* UE lower layer identifier */ @@ -111,25 +96,4 @@ typedef struct itti_nas_auth_param_req_s { uint8_t num_vectors; } itti_nas_auth_param_req_t; -typedef struct itti_nas_extended_service_req_s { - /* UE identifier */ - mme_ue_s1ap_id_t ue_id; - uint8_t servType; /* service type */ - /* csfb_response is valid only if service type Mobile Terminating CSFB */ - uint8_t csfb_response; -} itti_nas_extended_service_req_t; - -/* ITTI message used to intimate service reject for ongoing service request procedure - * from mme_app to nas - */ -typedef struct itti_nas_notify_service_reject_s { - mme_ue_s1ap_id_t ue_id; - uint8_t emm_cause; -#define INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED 0x00 -#define UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED 0x01 -#define MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE 0x02 -#define MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE 0x03 - uint8_t failed_procedure; -} itti_nas_notify_service_reject_t; - #endif /* FILE_NAS_MESSAGES_TYPES_SEEN */ diff --git a/lte/gateway/c/oai/lib/secu/nas_stream_eea1.c b/lte/gateway/c/oai/lib/secu/nas_stream_eea1.c index f875b440d1f7..417726e41908 100644 --- a/lte/gateway/c/oai/lib/secu/nas_stream_eea1.c +++ b/lte/gateway/c/oai/lib/secu/nas_stream_eea1.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -41,7 +41,6 @@ int nas_stream_encrypt_eea1( //uint32_t byte_length; uint32_t *KS; uint32_t K[4], IV[4]; - uint32_t len = 0; DevAssert(stream_cipher != NULL); DevAssert(stream_cipher->key != NULL); @@ -113,8 +112,6 @@ int nas_stream_encrypt_eea1( } free_wrapper((void **) &KS); - len = sizeof(out); - memset(out, 0, len); memcpy(out, stream_cipher->message, n * 4); if (zero_bit > 0) { diff --git a/lte/gateway/c/oai/lib/secu/nas_stream_eea2.c b/lte/gateway/c/oai/lib/secu/nas_stream_eea2.c index 215fd21f32b5..ff338fcbdcda 100644 --- a/lte/gateway/c/oai/lib/secu/nas_stream_eea2.c +++ b/lte/gateway/c/oai/lib/secu/nas_stream_eea2.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -41,7 +41,6 @@ int nas_stream_encrypt_eea2( uint8_t *data; uint32_t zero_bit = 0; uint32_t byte_length; - uint32_t len = 0; DevAssert(stream_cipher != NULL); DevAssert(out != NULL); @@ -76,8 +75,6 @@ int nas_stream_encrypt_eea2( data[byte_length - 1] = data[byte_length - 1] & (uint8_t)(0xFF << (8 - zero_bit)); - len = sizeof(out); - memset(out, 0, len); memcpy(out, data, byte_length); free_wrapper((void **) &data); free_wrapper((void **) &ctx); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c index adfa46ca9506..a0935cdebe56 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_bearer.c @@ -932,9 +932,7 @@ void mme_app_handle_delete_session_rsp( * send pdn disconnect response to NAS. * NAS will trigger deactivate Bearer Context Req to UE */ - if ( - (mme_config.eps_network_feature_support.ims_voice_over_ps_session_in_s1) && - (ue_context_p->emm_context.esm_ctx.is_pdn_disconnect)) { + if (ue_context_p->emm_context.esm_ctx.is_pdn_disconnect) { pdn_disconnect_rsp.ue_id = ue_context_p->mme_ue_s1ap_id; pdn_disconnect_rsp.lbi = delete_sess_resp_pP->lbi; if ((nas_proc_pdn_disconnect_rsp(&pdn_disconnect_rsp)) != RETURNok) { @@ -2171,35 +2169,32 @@ void mme_app_handle_suspend_acknowledge(mme_app_desc_t *mme_app_desc_p, } //------------------------------------------------------------------------------ -int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, - itti_nas_extended_service_req_t *const nas_extended_service_req_pP) +int mme_app_handle_nas_extended_service_req( + const mme_ue_s1ap_id_t ue_id, + const uint8_t service_type, + uint8_t csfb_response) { struct ue_mm_context_s *ue_context_p = NULL; + mme_app_desc_t* mme_app_desc_p = NULL; int rc = RETURNok; - mme_ue_s1ap_id_t ue_id = INVALID_MME_UE_S1AP_ID; - Service_Type serviceType = -1; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(nas_extended_service_req_pP); - serviceType = nas_extended_service_req_pP->servType; - ue_id = nas_extended_service_req_pP->ue_id; if (ue_id == INVALID_MME_UE_S1AP_ID) { OAILOG_ERROR( LOG_MME_APP, - "ERROR***** Invalid UE Id received from NAS in Extended Service " - "Request\n"); + "ERROR***** Invalid UE Id received in Extended Service Request \n"); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } + mme_app_desc_p = get_mme_nas_state(false); ue_context_p = - mme_ue_context_exists_mme_ue_s1ap_id(&mme_app_desc_p->mme_ue_contexts, - ue_id); + mme_ue_context_exists_mme_ue_s1ap_id(&mme_app_desc_p->mme_ue_contexts, ue_id); if (ue_context_p) { if (ue_id != ue_context_p->mme_ue_s1ap_id) { OAILOG_ERROR( LOG_MME_APP, "ERROR***** Abnormal case: ue_id does not match with ue_id in " - "ue_context %d, %d\n", + "ue_context" MME_UE_S1AP_ID_FMT "," MME_UE_S1AP_ID_FMT "\n", ue_id, ue_context_p->mme_ue_s1ap_id); unlock_ue_contexts(ue_context_p); @@ -2214,19 +2209,26 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - switch (serviceType) { + switch (service_type) { /* Extended Service request received for CSFB */ case MO_CS_FB1: case MT_CS_FB1: case MO_CS_FB: if (ue_context_p->sgs_context != NULL) { ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_MO_CALL; - /*If call_cancelled is set to TRUE when MO call is triggered. Set call_cancelled to false*/ - if (ue_context_p->sgs_context->call_cancelled == true) { + /* If call_cancelled is set to TRUE when MO call is triggered. + * Set call_cancelled to false + */ + if (ue_context_p->sgs_context->call_cancelled) { ue_context_p->sgs_context->call_cancelled = false; } mme_app_itti_ue_context_mod_for_csfb(ue_context_p); } else { + OAILOG_ERROR( + LOG_MME_APP, + "SGS context is NULL for ue_id:" MME_UE_S1AP_ID_FMT + "So send Service Reject to UE \n", + ue_context_p->mme_ue_s1ap_id); /* send Service Reject to UE */ mme_app_notify_service_reject_to_nas( ue_context_p->mme_ue_s1ap_id, @@ -2235,19 +2237,21 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } break; case MT_CS_FB: - if (nas_extended_service_req_pP->csfb_response == CSFB_REJECTED_BY_UE) { - if (ue_context_p->sgs_context != NULL) { - /*If call_cancelled is set to TRUE and we receive EXT Service Request with csfb_response - *set to call_rejected. Set call_cancelled to false*/ - if (ue_context_p->sgs_context->call_cancelled == true) { + if (csfb_response == CSFB_REJECTED_BY_UE) { + if (ue_context_p->sgs_context) { + /* If call_cancelled is set to TRUE and + * receive EXT Service Request with csfb_response + * set to call_rejected. Set call_cancelled to false + */ + if (ue_context_p->sgs_context->call_cancelled) { ue_context_p->sgs_context->call_cancelled = false; } - if ( - (rc = mme_app_send_sgsap_paging_reject( + rc = mme_app_send_sgsap_paging_reject( ue_context_p, ue_context_p->emm_context._imsi64, ue_context_p->emm_context._imsi.length, - SGS_CAUSE_MT_CSFB_CALL_REJECTED_BY_USER)) != RETURNok) { + SGS_CAUSE_MT_CSFB_CALL_REJECTED_BY_USER); + if (rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to send SGSAP-Paging Reject for imsi with reject cause:" @@ -2259,37 +2263,60 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } else { OAILOG_ERROR( LOG_MME_APP, - "sgs_context is null for ue" IMSI_64_FMT "\n", + "sgs_context is null for IMSI" IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } } else if ( - nas_extended_service_req_pP->csfb_response == CSFB_ACCEPTED_BY_UE) { - DevAssert(ue_context_p->sgs_context); - /*Set mt_call_in_progress flag as UE accepted the MT Call. + csfb_response == CSFB_ACCEPTED_BY_UE) { + if (!ue_context_p->sgs_context) { + OAILOG_ERROR( + LOG_MME_APP, + "sgs_context is null for IMSI" IMSI_64_FMT "\n", + ue_context_p->emm_context._imsi64); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + /* Set mt_call_in_progress flag as UE accepted the MT Call. * This will be used to decide whether to abort the on going MT call or * not when SERVICE ABORT request is received from MSC/VLR */ ue_context_p->sgs_context->mt_call_in_progress = true; if (ue_context_p->sgs_context->call_cancelled) { - /*Sending Service Reject to UE as MSC/VLR has triggered SGSAP SERVICE ABORT*/ + /* Sending Service Reject to UE as MSC/VLR has triggered + * SGSAP SERVICE ABORT + */ if (ue_context_p->ecm_state == ECM_IDLE) { + /* If ECM state is IDLE send + * service_reject in Establish cnf else send in DL NAS Transport + */ + OAILOG_ERROR( + LOG_MME_APP, + "MT CS call is accepted by UE in idle mode for ue_id:" + MME_UE_S1AP_ID_FMT " But MT_CALL_CANCEL is set by MSC," + " so sending service reject to UE \n", + ue_id); mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, + ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE, - MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE); + INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED); } else if (ue_context_p->ecm_state == ECM_CONNECTED) { + OAILOG_ERROR( + LOG_MME_APP, + "MT CS call is accepted by UE in connected mode for ue_id:" + MME_UE_S1AP_ID_FMT " But MT_CALL_CANCEL is set by MSC," + " so sending service reject to UE \n", + ue_id); mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, + ue_id, EMM_CAUSE_CS_SERVICE_NOT_AVAILABLE, - MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE); + UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } //Reset call_cancelled flag ue_context_p->sgs_context->call_cancelled = false; OAILOG_WARNING( LOG_MME_APP, - "Sending Service Reject to NAS as MSC has triggered SGSAP SERVICE " - "ABORT" - "Request for UE id :%u \n", + "Sending Service Reject to NAS module as MSC has triggered SGS " + "SERVICE ABORT Request for ue_id: " MME_UE_S1AP_ID_FMT "\n", ue_id); } else { mme_app_itti_ue_context_mod_for_csfb(ue_context_p); @@ -2297,8 +2324,9 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, } else { OAILOG_WARNING( LOG_MME_APP, - "Invalid csfb_response for service type :%d and ue_id :%u \n", - nas_extended_service_req_pP->servType, + "Invalid csfb_response for service type :%d and ue_id: " + MME_UE_S1AP_ID_FMT "\n", + service_type, ue_id); } break; @@ -2308,9 +2336,16 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, ue_context_p->sgs_context->is_emergency_call = true; mme_app_itti_ue_context_mod_for_csfb(ue_context_p); } else { - /* send Service Reject to UE */ - mme_app_notify_service_reject_to_nas(ue_context_p->mme_ue_s1ap_id, EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); + // Notify NAS module to send Service Reject message to UE + OAILOG_ERROR( + LOG_MME_APP, + "For MO_CS_FB_EMRGNCY_CALL, SGS context is not found for ue_id:" + MME_UE_S1AP_ID_FMT " MME shall send Service Reject to ue", + ue_context_p->mme_ue_s1ap_id); + mme_app_notify_service_reject_to_nas( + ue_context_p->mme_ue_s1ap_id, + EMM_CAUSE_CONGESTION, + UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } break; /* packet service via s1 */ @@ -2324,7 +2359,7 @@ int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, OAILOG_ERROR( LOG_MME_APP, "ERROR***** Invalid Service Type Received %d\n", - serviceType); + service_type); } unlock_ue_contexts(ue_context_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); @@ -2362,10 +2397,17 @@ int handle_csfb_s1ap_procedure_failure( char *failed_statement, uint8_t failed_procedure) { - int rc = RETURNok; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p != NULL); + if (!ue_context_p) { + OAILOG_ERROR(LOG_MME_APP, "Failed to find UE context \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + + OAILOG_ERROR( + LOG_MME_APP, + "Handle handle_csfb_s1ap_procedure_failure for ue_id" + MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); /* If ICS procedure is initiated due to CS-Paging in UE idle mode * On ICS failure, send sgsap-Paging Reject to VLR */ @@ -2392,24 +2434,18 @@ int handle_csfb_s1ap_procedure_failure( increment_counter( "sgsap_paging_reject", 1, 1, "cause", failed_statement); } - rc = mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, - EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); - } else if ( - ue_context_p->sgs_context->csfb_service_type == CSFB_SERVICE_MO_CALL) { - /* send Service Reject to UE */ - rc = mme_app_notify_service_reject_to_nas( - ue_context_p->mme_ue_s1ap_id, - EMM_CAUSE_CONGESTION, - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED); } + // send Service Reject to UE + mme_app_notify_service_reject_to_nas( + ue_context_p->mme_ue_s1ap_id, + EMM_CAUSE_CONGESTION, + failed_procedure); ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_NONE; if (failed_statement) { increment_counter("nas service reject", 1, 1, "cause", failed_statement); } } - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNok); } /**************************************************************************** @@ -2423,39 +2459,46 @@ int handle_csfb_s1ap_procedure_failure( ** emm_casue: failed cause ** ** Failed_procedure: ICS/UE context modification ** ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** ***************************************************************************/ - -int mme_app_notify_service_reject_to_nas( +void mme_app_notify_service_reject_to_nas( mme_ue_s1ap_id_t ue_id, uint8_t emm_cause, uint8_t failed_procedure) { - int rc = RETURNok; - MessageDef *message_p = NULL; - itti_nas_notify_service_reject_t *itti_nas_notify_service_reject_p = NULL; OAILOG_FUNC_IN(LOG_MME_APP); OAILOG_INFO( LOG_MME_APP, " Ongoing Service request procedure failed," - "send Notify Service Reject to NAS for ue_id :%u \n", + "send Notify Service Reject to NAS module for ue_id :" + MME_UE_S1AP_ID_FMT" \n", ue_id); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_NOTIFY_SERVICE_REJECT); - itti_nas_notify_service_reject_p = - &message_p->ittiMsg.nas_notify_service_reject; - memset( - (void *) itti_nas_notify_service_reject_p, - 0, - sizeof(itti_nas_extended_service_req_t)); - - itti_nas_notify_service_reject_p->ue_id = ue_id; - itti_nas_notify_service_reject_p->emm_cause = emm_cause; - itti_nas_notify_service_reject_p->failed_procedure = failed_procedure; - - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + switch (failed_procedure) { + case INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED: { + if ((emm_proc_service_reject(ue_id, emm_cause)) != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "emm_proc_service_reject() failed for ue_id "MME_UE_S1AP_ID_FMT "\n", + ue_id); + } + break; + } + case UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED: { + if ((emm_send_service_reject_in_dl_nas(ue_id, emm_cause)) != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "emm_send_service_reject_in_dl_nas() failed for ue_id " + MME_UE_S1AP_ID_FMT "\n", + ue_id); + } + break; + } + default: { + OAILOG_ERROR(LOG_MME_APP, "Invalid failed procedure for ue-id" + MME_UE_S1AP_ID_FMT "\n", ue_id); + break; + } + } + OAILOG_FUNC_OUT(LOG_MME_APP); } //------------------------------------------------------------------------------ void mme_app_handle_create_dedicated_bearer_rsp( diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h index 106700862bed..709b66e601c4 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_defs.h @@ -60,8 +60,10 @@ int mme_app_handle_s6a_update_location_ans(mme_app_desc_t *mme_app_desc_p, int mme_app_handle_s6a_cancel_location_req(mme_app_desc_t *mme_app_desc_p, const s6a_cancel_location_req_t *const clr_pP); -int mme_app_handle_nas_extended_service_req(mme_app_desc_t *mme_app_desc_p, - itti_nas_extended_service_req_t *const nas_extended_service_req_pP); +int mme_app_handle_nas_extended_service_req( + const mme_ue_s1ap_id_t ue_id, + const uint8_t servicetype, + uint8_t csfb_response); void mme_app_handle_detach_req(const mme_ue_s1ap_id_t ue_id); @@ -197,11 +199,6 @@ int mme_app_handle_s6a_reset_req(mme_app_desc_t *mme_app_desc_p, int mme_app_send_s6a_reset_ans(int rsa_result, void *msg_rsa_p); -int mme_app_send_nas_cs_service_notification( - mme_ue_s1ap_id_t ue_id, - uint8_t paging_id, - bstring cli); - int mme_app_send_sgsap_service_request( uint8_t service_indicator, struct ue_mm_context_s *ue_context_p); @@ -253,7 +250,7 @@ int mme_app_send_sgsap_paging_reject( uint8_t imsi_len, SgsCause_t sgs_cause); -int mme_app_notify_service_reject_to_nas( +void mme_app_notify_service_reject_to_nas( mme_ue_s1ap_id_t ue_id, uint8_t emm_cause, uint8_t failed_procedure); @@ -338,7 +335,7 @@ int map_sgs_emm_cause(SgsRejectCause_t sgs_cause); pthread_rwlock_wrlock(&(mMEsTATS)->rw_lock) #define mme_stats_unlock(mMEsTATS) pthread_rwlock_unlock(&(mMEsTATS)->rw_lock) -#define mme_app_compare_tmsi(_tmsi1, _tmsi2) \ +#define MME_APP_COMPARE_TMSI(_tmsi1, _tmsi2) \ ( \ (_tmsi1.tmsi[0] != _tmsi2.tmsi[0]) || (_tmsi1.tmsi[1] != _tmsi2.tmsi[1]) ||\ (_tmsi1.tmsi[2] != _tmsi2.tmsi[2]) || (_tmsi1.tmsi[3] != _tmsi2.tmsi[3])) \ diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c index 73b593f9f0d0..cc30c9c82b00 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.c @@ -60,7 +60,17 @@ #define TASK_SPGW TASK_S11 #endif -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_itti_ue_context_release() ** + ** ** + ** description: Send itti mesage to S1ap task to send UE Context Release ** + ** Request ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** emm_casue: failed cause ** + ** ** + ***************************************************************************/ void mme_app_itti_ue_context_release( struct ue_mm_context_s *ue_context_p, enum s1cause cause) @@ -70,6 +80,12 @@ void mme_app_itti_ue_context_release( OAILOG_FUNC_IN(LOG_MME_APP); message_p = itti_alloc_new_message(TASK_MME_APP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for S1AP_UE_CONTEXT_RELEASE_COMMAND \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } OAILOG_INFO( LOG_MME_APP, "Sending UE Context Release Cmd to S1ap for (ue_id = %u)\n" @@ -86,7 +102,20 @@ void mme_app_itti_ue_context_release( OAILOG_FUNC_OUT(LOG_MME_APP); } -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_send_s11_release_access_bearers_req ** + ** ** + ** description: Send itti mesage to SPGW task to send Release Access ** + ** Bearer Request (RAB) ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** pdn_index: PDN index for which RAB is initiated ** + ** ** + ** outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** + ***************************************************************************/ int mme_app_send_s11_release_access_bearers_req( struct ue_mm_context_s *const ue_mm_context, const pdn_cid_t pdn_index) @@ -103,6 +132,12 @@ int mme_app_send_s11_release_access_bearers_req( DevAssert(ue_mm_context); message_p = itti_alloc_new_message(TASK_MME_APP, S11_RELEASE_ACCESS_BEARERS_REQUEST); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for S11_RELEASE_ACCESS_BEARERS_REQUEST \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } release_access_bearers_request_p = &message_p->ittiMsg.s11_release_access_bearers_request; release_access_bearers_request_p->local_teid = ue_mm_context->mme_teid_s11; @@ -117,7 +152,20 @@ int mme_app_send_s11_release_access_bearers_req( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -//------------------------------------------------------------------------------ +/**************************************************************************** + ** ** + ** name: mme_app_send_s11_create_session_req ** + ** ** + ** description: Send itti mesage to SPGW task to send Create Session ** + ** Request (CSR) ** + ** ** + ** inputs: ue_context_p: Pointer to UE context ** + ** pdn_index: PDN index for which CSR is initiated ** + ** ** + ** outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** + ***************************************************************************/ int mme_app_send_s11_create_session_req( mme_app_desc_t* mme_app_desc_p, struct ue_mm_context_s* const ue_mm_context, @@ -324,3 +372,208 @@ int mme_app_send_s11_create_session_req( rc = itti_send_msg_to_task(TASK_SPGW, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } + +/**************************************************************************** + ** ** + ** name: nas_itti_sgsap_uplink_unitdata ** + ** ** + ** description: Send itti mesage to SGS task to send NAS message ** + ** ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** nas_msg: NAS message ** + ** imeisv_pP: IMEISV of UE ** + ** mobilestationclassmark2_pP: Mobile station classmark-2 of UE ** + ** tai_pP: TAI of UE ** + ** ecgi_pP: ecgi of UE ** + ** ** + ***************************************************************************/ +void nas_itti_sgsap_uplink_unitdata( + const char *const imsi, + uint8_t imsi_len, + bstring nas_msg, + imeisv_t *imeisv_pP, + MobileStationClassmark2 *mobilestationclassmark2_pP, + tai_t *tai_pP, + ecgi_t *ecgi_pP) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + int uetimezone = 0; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_UPLINK_UNITDATA); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_UPLINK_UNITDATA \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_uplink_unitdata, + 0, + sizeof(itti_sgsap_uplink_unitdata_t)); + memcpy(SGSAP_UPLINK_UNITDATA(message_p).imsi, imsi, imsi_len); + SGSAP_UPLINK_UNITDATA(message_p).imsi[imsi_len] = '\0'; + SGSAP_UPLINK_UNITDATA(message_p).imsi_length = imsi_len; + SGSAP_UPLINK_UNITDATA(message_p).nas_msg_container = nas_msg; + nas_msg = NULL; + /* + * optional - UE Time Zone + * update the ue time zone presence bitmask + */ + if ((uetimezone = get_time_zone()) != RETURNerror) { + SGSAP_UPLINK_UNITDATA(message_p).opt_ue_time_zone = timezone; + SGSAP_UPLINK_UNITDATA(message_p).presencemask = + UPLINK_UNITDATA_UE_TIMEZONE_PARAMETER_PRESENT; + } + /* + * optional - IMEISV + * update the imeisv presence bitmask + */ + if (imeisv_pP) { + hexa_to_ascii( + (uint8_t *) imeisv_pP->u.value, + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv, + 8); + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv[imeisv_pP->length] = '\0'; + SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv_length = imeisv_pP->length; + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_IMEISV_PARAMETER_PRESENT; + } + /* + * optional - mobile station classmark2 + * update the mobile station classmark2 presence bitmask. + */ + if (mobilestationclassmark2_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_mobilestationclassmark2 = + *((MobileStationClassmark2_t *) mobilestationclassmark2_pP); + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_MOBILE_STATION_CLASSMARK_2_PARAMETER_PRESENT; + } + /* + * optional - tai + * update the tai presence bitmask. + */ + if (tai_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_tai = *((tai_t *) tai_pP); + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_TAI_PARAMETER_PRESENT; + } + /* + * optional - ecgi + * update the ecgi presence bitmask. + */ + if (ecgi_pP) { + SGSAP_UPLINK_UNITDATA(message_p).opt_ecgi = *ecgi_pP; + SGSAP_UPLINK_UNITDATA(message_p).presencemask |= + UPLINK_UNITDATA_ECGI_PARAMETER_PRESENT; + } + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP Uplink Unitdata to SGS task for Imsi : " + "%s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP Uplink Unitdata to SGS task for Imsi :%s \n", + imsi); + } + + OAILOG_FUNC_OUT(LOG_MME_APP); +} + +/**************************************************************************** + ** ** + ** name: mme_app_itti_sgsap_tmsi_reallocation_comp ** + ** ** + ** description: Send itti mesage, TMSI Reallocation Complete message ** + ** to SGS task ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** ** + ***************************************************************************/ +void mme_app_itti_sgsap_tmsi_reallocation_comp( + const char *imsi, + const unsigned int imsi_len) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_TMSI_REALLOC_COMP); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_TMSI_REALLOC_COMP \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_tmsi_realloc_comp, + 0, + sizeof(itti_sgsap_tmsi_reallocation_comp_t)); + memcpy(SGSAP_TMSI_REALLOC_COMP(message_p).imsi, imsi, imsi_len); + SGSAP_TMSI_REALLOC_COMP(message_p).imsi[imsi_len] = '\0'; + SGSAP_TMSI_REALLOC_COMP(message_p).imsi_length = imsi_len; + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP Tmsi Reallocation Complete to SGS task for Imsi : " + "%s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP Tmsi Reallocation Complete to SGS task for Imsi :%s \n", + imsi); + } + OAILOG_FUNC_OUT(LOG_MME_APP); +} + +/**************************************************************************** + ** ** + ** name: mme_app_itti_sgsap_ue_activity_ind ** + ** ** + ** description: Send itti mesage, UE Activity Indication message ** + ** to SGS task ** + ** inputs: imsi : IMSI of UE ** + ** imsi_len : Length of IMSI ** + ** ** + ***************************************************************************/ +void mme_app_itti_sgsap_ue_activity_ind( + const char *imsi, + const unsigned int imsi_len) +{ + OAILOG_FUNC_IN(LOG_MME_APP); + MessageDef *message_p = NULL; + + message_p = itti_alloc_new_message(TASK_MME_APP, SGSAP_UE_ACTIVITY_IND); + if (message_p == NULL) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to allocate memory for SGSAP_UE_ACTIVITY_IND \n"); + OAILOG_FUNC_OUT(LOG_MME_APP); + } + memset( + &message_p->ittiMsg.sgsap_ue_activity_ind, + 0, + sizeof(itti_sgsap_ue_activity_ind_t)); + memcpy(SGSAP_UE_ACTIVITY_IND(message_p).imsi, imsi, imsi_len); + SGSAP_UE_ACTIVITY_IND(message_p).imsi[imsi_len] = '\0'; + SGSAP_UE_ACTIVITY_IND(message_p).imsi_length = imsi_len; + if (itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p) + != RETURNok) { + OAILOG_ERROR( + LOG_MME_APP, + "Failed to send SGSAP UE ACTIVITY IND to SGS task for Imsi : %s \n", + imsi); + } else { + OAILOG_DEBUG( + LOG_MME_APP, + "Sent SGSAP UE ACTIVITY IND to SGS task for Imsi :%s \n", + imsi); + } + OAILOG_FUNC_OUT(LOG_MME_APP); +} diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h index 97ccf54446a0..9a9e4577a9a2 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_itti_messaging.h @@ -124,4 +124,21 @@ static inline void mme_app_itti_ue_context_mod_for_csfb( OAILOG_FUNC_OUT(LOG_MME_APP); } +void nas_itti_sgsap_uplink_unitdata( + const char *const imsi, + uint8_t imsi_len, + bstring nas_msg, + imeisv_t *imeisv, + MobileStationClassmark2 *mobilestationclassmark2, + tai_t *tai, + ecgi_t *ecgi); + +void mme_app_itti_sgsap_tmsi_reallocation_comp( + const char *imsi, + const unsigned int imsi_len); + +void mme_app_itti_sgsap_ue_activity_ind( + const char *imsi, + const unsigned int imsi_len); + #endif /* FILE_MME_APP_ITTI_MESSAGING_SEEN */ diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c index 145ff71c39a5..9e9fc633c49d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_main.c @@ -188,11 +188,6 @@ void *mme_app_thread(void *args) mme_app_handle_e_rab_rel_rsp(&S1AP_E_RAB_REL_RSP(received_message_p)); } break; - case NAS_EXTENDED_SERVICE_REQ: { - mme_app_handle_nas_extended_service_req(mme_app_desc_p, - &received_message_p->ittiMsg.nas_extended_service_req); - } break; - case S1AP_INITIAL_UE_MESSAGE: { mme_app_handle_initial_ue_message(mme_app_desc_p, &S1AP_INITIAL_UE_MESSAGE(received_message_p)); @@ -470,10 +465,31 @@ void *mme_app_thread(void *args) &MME_APP_DL_DATA_REJ(received_message_p).nas_msg); } break; - case TERMINATE_MESSAGE: { - /* - * Termination message received TODO -> release any data allocated - */ + case SGSAP_DOWNLINK_UNITDATA: { + /* We received the Downlink Unitdata from MSC, trigger a + * Downlink Nas Transport message to UE. + */ + nas_proc_downlink_unitdata( + &SGSAP_DOWNLINK_UNITDATA(received_message_p)); + } break; + + case SGSAP_RELEASE_REQ: { + /* We received the SGS Release request from MSC,to indicate that there + * are no more NAS messages to be exchanged between the VLR and the UE, + * or when a further exchange of NAS messages for the specified UE is + * not possible due to an error. + */ + nas_proc_sgs_release_req(&SGSAP_RELEASE_REQ(received_message_p)); + } break; + + case SGSAP_MM_INFORMATION_REQ: { + // Received SGSAP MM Information Request message from SGS task + nas_proc_cs_domain_mm_information_request( + &SGSAP_MM_INFORMATION_REQ(received_message_p)); + } break; + + case TERMINATE_MESSAGE: { + // Termination message received TODO -> release any data allocated put_mme_nas_state(&mme_app_desc_p); mme_app_exit(); itti_free_msg_content(received_message_p); diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c index c1d4ee4036de..7a80c49d7b91 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgs_paging.c @@ -82,15 +82,15 @@ static int _sgs_handle_paging_request_for_mt_sms_in_connected( static int _sgs_handle_paging_request_for_mt_sms_in_idle( ue_mm_context_t *ue_context_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP); -/********************************************************************************** - ** ** - ** Name: sgs_handle_associated_paging_request() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ +/***************************************************************************** + ** ** + ** Name: sgs_handle_associated_paging_request() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) { int rc = RETURNerror; @@ -101,7 +101,8 @@ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) OAILOG_DEBUG( LOG_MME_APP, - "Handle paging request in Associated state for ue-id :%u \n", + "Handle paging request in Associated state for ue-id " + MME_UE_S1AP_ID_FMT "\n", evt->ue_id); sgs_context_t *sgs_context = (sgs_context_t *) evt->ctx; sgsap_paging_req_pP = (itti_sgsap_paging_request_t *) sgs_context->sgsap_msg; @@ -115,18 +116,16 @@ int sgs_handle_associated_paging_request(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_sms() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** for Mobile terminating sms ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** - ** ue_context_p: UE context - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_sms() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** for Mobile terminating sms ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) { int rc = RETURNerror; @@ -136,7 +135,7 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t *mme_app_desc_p = get_mme_nas_state(false); + mme_app_desc_t* mme_app_desc_p = get_mme_nas_state(false); ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( &mme_app_desc_p->mme_ue_contexts, evt->ue_id); if (!ue_context_p) { @@ -191,28 +190,27 @@ static int _sgs_handle_paging_request_for_mt_sms(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_call() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** for Mobile terminating call ** - ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** +/****************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_call() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** for Mobile terminating call ** + ** Inputs: sgs_fsm_t: pointer for sgs_fsm_primitive structure ** ** ue_context_p: UE context - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - -static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +*******************************************************************************/ +static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t* evt) { int rc = RETURNerror; - ue_mm_context_t *ue_context_p = NULL; - sgs_context_t *sgs_context = NULL; - itti_sgsap_paging_request_t *sgsap_paging_req_pP = NULL; + ue_mm_context_t* ue_context_p = NULL; + sgs_context_t* sgs_context = NULL; + itti_sgsap_paging_request_t* sgsap_paging_req_pP = NULL; imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - mme_app_desc_t *mme_app_desc_p = get_mme_nas_state(false); + mme_app_desc_t* mme_app_desc_p = get_mme_nas_state(false); ue_context_p = mme_ue_context_exists_mme_ue_s1ap_id( &mme_app_desc_p->mme_ue_contexts, evt->ue_id); if (!ue_context_p) { @@ -223,7 +221,9 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } sgs_context = (sgs_context_t *) evt->ctx; - /*If call_cancelled is set to TRUE when a new Paging message is received.Set call_cancelled to false*/ + /* If call_cancelled is set to TRUE when a new Paging message + * is received.Set call_cancelled to false + */ if (sgs_context->call_cancelled == true) { sgs_context->call_cancelled = false; } @@ -257,7 +257,7 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } - /* Check the vlr-reliable flag */ + // Check the vlr-reliable flag if (sgs_context->vlr_reliable == false) { OAILOG_DEBUG( LOG_MME_APP, @@ -265,7 +265,9 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) "\n", sgs_context->vlr_reliable, ue_context_p->emm_context._imsi64); - /* Handling for paging received without LAI and vlr-reliable flag set to false is same */ + /* Handling for paging received without LAI and vlr-reliable flag set to + * false is same + */ rc = _sgsap_handle_paging_request_without_lai( ue_context_p, sgsap_paging_req_pP); unlock_ue_contexts(ue_context_p); @@ -283,28 +285,35 @@ static int _sgs_handle_paging_request_for_mt_call(const sgs_fsm_t *evt) OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_call_in_connected() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** and UE connected state for Mobile terminating call ** - ** Inputs: ue_context_p: UE context ** - ** itti_sgsap_paging_request_t : received sgs-paging request ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_call_in_connected() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** and UE connected state for Mobile terminating call ** + ** Inputs: ue_context_p: UE context ** + ** itti_sgsap_paging_request_t : received sgs-paging request ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_call_in_connected( - ue_mm_context_t *ue_context_p, - itti_sgsap_paging_request_t *const sgsap_paging_req_pP) + ue_mm_context_t* ue_context_p, + itti_sgsap_paging_request_t* const sgsap_paging_req_pP) { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; bstring cli = NULL; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(ue_context_p); - DevAssert(sgsap_paging_req_pP); + + if (!ue_context_p) { + OAILOG_ERROR(LOG_MME_APP, "Invalid ue_context_p \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } + if (!sgsap_paging_req_pP) { + OAILOG_ERROR(LOG_MME_APP, "Null Paging Request Received \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); + } OAILOG_INFO( LOG_MME_APP, @@ -315,25 +324,26 @@ static int _sgs_handle_paging_request_for_mt_call_in_connected( /* Fetch TMSI if present */ if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } /* Fetch CLI if present */ if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_CLI_PARAMETER_PRESENT) { bassign(cli, sgsap_paging_req_pP->opt_cli); } - if ( - RETURNok != (rc = mme_app_send_nas_cs_service_notification( - ue_context_p->mme_ue_s1ap_id, paging_id, cli))) { + rc = nas_proc_cs_service_notification( + ue_context_p->mme_ue_s1ap_id, paging_id, cli); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, - "Failed to send CS-Service Notification to NAS for ue-id :%u \n", + "Failed to handle CS-Service Notification at NAS module for" + " ue-id:" MME_UE_S1AP_ID_FMT "\n", ue_context_p->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } - if ( - RETURNok != (rc = mme_app_send_sgsap_service_request( - sgsap_paging_req_pP->service_indicator, ue_context_p))) { + rc = mme_app_send_sgsap_service_request( + sgsap_paging_req_pP->service_indicator, ue_context_p); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send CS-Service Request to SGS-Task for ue-id :%u \n", @@ -344,18 +354,17 @@ static int _sgs_handle_paging_request_for_mt_call_in_connected( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: _sgs_handle_paging_request_for_mt_sms_in_connected() ** - ** Description Handle SGSAP-Paging request in SGS-Associated state ** - ** and UE connected state for Mobile terminating sms ** - ** Inputs: ue_context_p: UE context ** - ** itti_sgsap_paging_request_t : received sgs-paging request ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ - +/***************************************************************************** + ** ** + ** Name: _sgs_handle_paging_request_for_mt_sms_in_connected() ** + ** Description Handle SGSAP-Paging request in SGS-Associated state ** + ** and UE connected state for Mobile terminating sms ** + ** Inputs: ue_context_p: UE context ** + ** itti_sgsap_paging_request_t : received sgs-paging request ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** + ** ** +******************************************************************************/ static int _sgs_handle_paging_request_for_mt_sms_in_connected( ue_mm_context_t *ue_context_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP) @@ -374,7 +383,7 @@ static int _sgs_handle_paging_request_for_mt_sms_in_connected( if ( RETURNok != (rc = mme_app_send_sgsap_service_request( - sgsap_paging_req_pP->service_indicator, ue_context_p))) { + sgsap_paging_req_pP->service_indicator, ue_context_p))) { OAILOG_ERROR( LOG_MME_APP, "Failed to send CS-Service Request to SGS-Task for ue-id :%u \n", @@ -403,7 +412,7 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); DevAssert(ue_context_p); DevAssert(sgsap_paging_req_pP); @@ -426,18 +435,18 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( "IMSI " IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); rc = mme_app_paging_request_helper( - ue_context_p, false, NAS_PAGING_ID_IMSI, CN_DOMAIN_PS); + ue_context_p, false, MME_APP_PAGING_ID_IMSI, CN_DOMAIN_PS); } else { - /* Fetch TMSI if present */ + // Fetch TMSI if present if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } - /* if TMSI is received, then page with S-TMSI otherwise page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, CN_DOMAIN_CS)) != RETURNok) { + // if TMSI is received, then page with S-TMSI otherwise page with IMSI + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, CN_DOMAIN_CS); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send PAGING Message to UE for UE-id:%u \n", @@ -448,10 +457,9 @@ static int _sgs_handle_paging_request_for_mt_call_in_idle( sgsap_paging_req_pP->service_indicator; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + _mme_app_send_sgsap_ue_unreachable(ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -479,7 +487,7 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( { int rc = RETURNerror; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); DevAssert(ue_context_p); DevAssert(sgsap_paging_req_pP); @@ -502,18 +510,18 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( "IMSI " IMSI_64_FMT "\n", ue_context_p->emm_context._imsi64); rc = mme_app_paging_request_helper( - ue_context_p, false, NAS_PAGING_ID_IMSI, CN_DOMAIN_PS); + ue_context_p, false, MME_APP_PAGING_ID_IMSI, CN_DOMAIN_PS); } else { - /* Fetch TMSI if present */ + // Fetch TMSI if present if ( sgsap_paging_req_pP->presencemask & PAGING_REQUEST_TMSI_PARAMETER_PRESENT) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; } - /* if TMSI is received, then page with S-TMSI otherwise page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, CN_DOMAIN_PS)) != RETURNok) { + // if TMSI is received, then page with S-TMSI otherwise page with IMSI + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, CN_DOMAIN_PS); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send PAGING Message to UE for UE-id:%u \n", @@ -524,10 +532,10 @@ static int _sgs_handle_paging_request_for_mt_sms_in_idle( sgsap_paging_req_pP->service_indicator; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + rc = _mme_app_send_sgsap_ue_unreachable( + ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -596,60 +604,17 @@ int mme_app_send_sgsap_service_request( OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/********************************************************************************** - ** ** - ** Name: mme_app_send_nas_cs_service_notification() ** - ** Description If SGSAP-Paging request received in UE ECM_Connected state ** - ** Send CS Service Notofication ** - ** Inputs: ue_id: UE identifier ** - ** paging_id Indicates the identity used for paging non-eps services ** - ** cli Calling Line Identification ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** -***********************************************************************************/ -int mme_app_send_nas_cs_service_notification( - mme_ue_s1ap_id_t ue_id, - uint8_t paging_id, - bstring cli) -{ - int rc = RETURNerror; - MessageDef *message_p = NULL; - itti_nas_cs_service_notification_t *cs_service_notification_p = NULL; - - OAILOG_FUNC_IN(LOG_MME_APP); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_CS_SERVICE_NOTIFICATION); - AssertFatal(message_p, "itti_alloc_new_message Failed"); - cs_service_notification_p = &message_p->ittiMsg.nas_cs_service_notification; - memset( - (void *) cs_service_notification_p, - 0, - sizeof(itti_nas_cs_service_notification_t)); - - cs_service_notification_p->ue_id = ue_id; - cs_service_notification_p->paging_id = paging_id; - bassign(cs_service_notification_p->cli, cli); - - OAILOG_INFO( - LOG_MME_APP, - "Send NAS CS Service Notification from MME app for ue_id:%u \n", - ue_id); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} - -/********************************************************************************** - ** ** - ** Name: mme_app_send_sgsap_paging_reject() ** - ** Description Build and send Paging reject ** - ** Inputs: ue_context_p: pointer ue_context ** - ** imsi : imsi ** - ** sgs_cause : paging reject cause ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** +/***************************************************************************** + ** ** + ** Name: mme_app_send_sgsap_paging_reject() ** + ** Description Build and send Paging reject ** + ** Inputs: ue_context_p: pointer ue_context ** + ** imsi : imsi ** + ** sgs_cause : paging reject cause ** + ** Outputs: ** + ** Return: RETURNok, RETURNerror ** ** -***********************************************************************************/ +******************************************************************************/ int mme_app_send_sgsap_paging_reject( struct ue_mm_context_s *ue_context_p, imsi64_t imsi, @@ -807,14 +772,13 @@ static int _mme_app_send_sgsap_ue_unreachable( ** Return: RETURNok, RETURNerror ** ** ***********************************************************************************/ - static int _sgsap_handle_paging_request_without_lai( - ue_mm_context_t *ue_context_p, - itti_sgsap_paging_request_t *const sgsap_paging_req_pP) + ue_mm_context_t* ue_context_p, + itti_sgsap_paging_request_t* const sgsap_paging_req_pP) { int rc = RETURNok; s1ap_cn_domain_t cn_domain = CN_DOMAIN_CS; - uint8_t paging_id = NAS_PAGING_ID_IMSI; + uint8_t paging_id = MME_APP_PAGING_ID_IMSI; OAILOG_FUNC_IN(LOG_MME_APP); if (!ue_context_p) { @@ -822,7 +786,7 @@ static int _sgsap_handle_paging_request_without_lai( OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } if (!sgsap_paging_req_pP) { - OAILOG_ERROR(LOG_MME_APP, "Null Pagaing Request Received \n"); + OAILOG_ERROR(LOG_MME_APP, "Null Paging Request Received \n"); OAILOG_FUNC_RETURN(LOG_MME_APP, RETURNerror); } @@ -832,7 +796,7 @@ static int _sgsap_handle_paging_request_without_lai( "\n", ue_context_p->emm_context._imsi64); if (ue_context_p->ecm_state == ECM_CONNECTED) { - // Send N/W Initiated Detach Request to NAS + // Send N/W Initiated Detach Request to NAS module emm_cn_nw_initiated_detach_ue_t emm_cn_nw_initiated_detach = {0}; emm_cn_nw_initiated_detach.ue_id = ue_context_p->mme_ue_s1ap_id; @@ -843,23 +807,27 @@ static int _sgsap_handle_paging_request_without_lai( * The value of ppf-paging proceeding flag will be "true" */ if (ue_context_p->ppf) { - /* if Paging request received without LAI for MT SMS, always page with S-TMSI */ + /* if Paging request received without LAI for MT SMS, + * always page with S-TMSI + */ if (sgsap_paging_req_pP->service_indicator == SGSAP_SMS_INDICATOR) { - paging_id = NAS_PAGING_ID_TMSI; + paging_id = MME_APP_PAGING_ID_TMSI; cn_domain = CN_DOMAIN_PS; } - /* if Paging request received without LAI for CS call, always page with IMSI */ - if ( - (rc = mme_app_paging_request_helper( - ue_context_p, false, paging_id, cn_domain)) == RETURNok) { + /* if Paging request received without LAI for CS call, + * always page with IMSI + */ + rc = mme_app_paging_request_helper( + ue_context_p, false, paging_id, cn_domain); + if (rc == RETURNok) { ue_context_p->sgs_context->csfb_service_type = CSFB_SERVICE_MT_CALL_OR_SMS_WITHOUT_LAI; } } else { - /* Send UE Unreachable to MSC/VLR */ - if ( - RETURNok != (rc = _mme_app_send_sgsap_ue_unreachable( - ue_context_p, SGS_CAUSE_UE_UNREACHABLE))) { + // Send UE Unreachable to MSC/VLR + rc = _mme_app_send_sgsap_ue_unreachable( + ue_context_p, SGS_CAUSE_UE_UNREACHABLE); + if (rc != RETURNok) { OAILOG_ERROR( LOG_MME_APP, "Failed to send SGSAP-UE-UNREACHABLE for ue-id :%u \n", @@ -883,17 +851,19 @@ static int _sgsap_handle_paging_request_without_lai( ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ - -int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, +int mme_app_handle_sgsap_paging_request(mme_app_desc_t* mme_app_desc_p, itti_sgsap_paging_request_t *const sgsap_paging_req_pP) { - struct ue_mm_context_s *ue_context_p = NULL; - int rc = RETURNok; + struct ue_mm_context_s* ue_context_p = NULL; + int rc = RETURNerror; sgs_fsm_t sgs_fsm; imsi64_t imsi64 = INVALID_IMSI64; OAILOG_FUNC_IN(LOG_MME_APP); - DevAssert(sgsap_paging_req_pP); + if (!sgsap_paging_req_pP) { + OAILOG_ERROR(LOG_MME_APP, "Received sgsap_paging_req_pP is NULL \n"); + OAILOG_FUNC_RETURN(LOG_MME_APP, rc); + } IMSI_STRING_TO_IMSI64(sgsap_paging_req_pP->imsi, &imsi64); @@ -934,8 +904,9 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, sgs_fsm.ue_id = ue_context_p->mme_ue_s1ap_id; sgs_fsm.ctx = (void *) ue_context_p->sgs_context; - /* Invoke SGS FSM */ - if (RETURNok != (rc = sgs_fsm_process(&sgs_fsm))) { + // Invoke SGS FSM + rc = sgs_fsm_process(&sgs_fsm); + if(rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to execute SGS State machine for ue_id :%u \n", diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c index 6e7b55d09dab..f9a9a84a508d 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap.c @@ -111,8 +111,9 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, sgs_fsm.ue_id = ue_context_p->mme_ue_s1ap_id; sgs_fsm.ctx = (void *) ue_context_p->sgs_context; - /* Invoke SGS FSM */ - if (RETURNok != (rc = sgs_fsm_process(&sgs_fsm))) { + // Invoke SGS FSM + rc = sgs_fsm_process(&sgs_fsm); + if(rc != RETURNok) { OAILOG_WARNING( LOG_MME_APP, "Failed to execute SGS State machine for ue_id :%u \n", @@ -123,51 +124,3 @@ int mme_app_handle_sgsap_paging_request(mme_app_desc_t *mme_app_desc_p, OAILOG_FUNC_RETURN(LOG_MME_APP, rc); } -/**************************************************************************** - ** ** - ** Name: mme_app_notify_service_reject_to_nas() ** - ** ** - ** Description: As part of handling CSFB procedure, if ICS or UE context ** - ** modification failed, indicate to NAS to send Service Reject to UE ** - ** ** - ** Inputs: ue_id: UE identifier ** - ** emm_casue: failed cause ** - ** Failed_procedure: ICS/UE context modification ** - ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** - ***************************************************************************/ - -int mme_app_notify_service_reject_to_nas( - mme_ue_s1ap_id_t ue_id, - uint8_t emm_cause, - uint8_t failed_procedure) -{ - int rc = RETURNok; - MessageDef *message_p = NULL; - itti_nas_notify_service_reject_t *itti_nas_notify_service_reject_p = NULL; - OAILOG_FUNC_IN(LOG_MME_APP); - OAILOG_INFO( - LOG_MME_APP, - " Ongoing Service request procedure failed," - "send Notify Service Reject to NAS for ue_id :%u \n", - ue_id); - message_p = itti_alloc_new_message(TASK_MME_APP, NAS_NOTIFY_SERVICE_REJECT); - itti_nas_notify_service_reject_p = - &message_p->ittiMsg.nas_notify_service_reject; - memset( - (void *) itti_nas_notify_service_reject_p, - 0, - sizeof(itti_nas_extended_service_req_t)); - - itti_nas_notify_service_reject_p->ue_id = ue_id; - itti_nas_notify_service_reject_p->emm_cause = emm_cause; - itti_nas_notify_service_reject_p->failed_procedure = failed_procedure; - - OAILOG_INFO( - LOG_MME_APP, " Send Notify service reject to NAS for UE-id :%u \n", ue_id); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_RETURN(LOG_MME_APP, rc); -} diff --git a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c index 50c8096c0f6c..d6370682f459 100644 --- a/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c +++ b/lte/gateway/c/oai/tasks/mme_app/mme_app_sgsap_location_update.c @@ -338,7 +338,7 @@ static int _handle_cs_domain_loc_updt_acc( * store the new TMSI and set flag */ if ( - mme_app_compare_tmsi( + MME_APP_COMPARE_TMSI( emm_ctx_p->csfbparams.mobileid.tmsi, received_tmsi) == RETURNerror) { OAILOG_INFO(LOG_MME_APP, "MME-APP - New TMSI Allocated\n"); memcpy( diff --git a/lte/gateway/c/oai/tasks/nas/emm/Attach.c b/lte/gateway/c/oai/tasks/nas/emm/Attach.c index 5a7aa50bc66e..d2e02efb50cd 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/Attach.c +++ b/lte/gateway/c/oai/tasks/nas/emm/Attach.c @@ -78,7 +78,7 @@ #include "esm_sap.h" #include "emm_cause.h" #include "mme_config.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "service303.h" #include "common_ies.h" #include "3gpp_23.003.h" @@ -720,7 +720,7 @@ int emm_proc_attach_complete( OAILOG_INFO( LOG_NAS_EMM, " Sending SGSAP TMSI REALLOCATION COMPLETE to SGS for ue_id = (%u)\n", ue_id); - nas_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); emm_ctx->csfbparams.newTmsiAllocated = false; /* update the neaf flag to false after sending the Tmsi Reallocation Complete message to SGS */ mme_ue_context_update_ue_sgs_neaf(ue_id, false); diff --git a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c index b503f28ea304..ff1d1b44aa19 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/NasTransportHdl.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -33,7 +33,7 @@ Subsystem EPS Mobility Management - Author + Author Description Defines the Nas Transport EMM procedure executed by the Non-Access Stratum. @@ -45,7 +45,7 @@ #include "emm_proc.h" #include "log.h" #include "emm_data.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "conversions.h" #include "3gpp_23.003.h" #include "3gpp_36.401.h" diff --git a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c index 801310e3038d..9df1a16fc1d8 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c +++ b/lte/gateway/c/oai/tasks/nas/emm/ServiceRequestHdl.c @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -32,7 +32,7 @@ #include "emm_data.h" #include "emm_sap.h" #include "emm_cause.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "service303.h" #include "conversions.h" #include "3gpp_23.003.h" @@ -47,6 +47,7 @@ #include "mme_api.h" #include "mme_app_state.h" #include "nas_message.h" +#include "mme_app_defs.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -188,7 +189,7 @@ int emm_proc_extended_service_request( if (mme_ue_context_get_ue_sgs_neaf(ue_id) == true) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); mme_ue_context_update_ue_sgs_neaf(ue_id, false); } } @@ -210,9 +211,10 @@ int emm_proc_extended_service_request( emm_context_unlock(emm_ctx); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } - /* notify MME-APP for extended service request reception in ue connected mode */ + // Handle extended service request received in ue connected mode emm_context_unlock(emm_ctx); - nas_itti_extended_service_req(ue_id, msg->servicetype, msg->csfbresponse); + mme_app_handle_nas_extended_service_req(ue_id, msg->servicetype, + msg->csfbresponse); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -270,7 +272,7 @@ int emm_recv_initial_ext_service_request( if (mme_ue_context_get_ue_sgs_neaf(ue_id) == true) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); mme_ue_context_update_ue_sgs_neaf(ue_id, false); } } diff --git a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c index 2487c45b2b94..816316ea9586 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c +++ b/lte/gateway/c/oai/tasks/nas/emm/TrackingAreaUpdate.c @@ -256,7 +256,7 @@ int emm_proc_tracking_area_update_request( if (IS_EMM_CTXT_PRESENT_SECURITY(emm_context)) { emm_context->_security.kenb_ul_count = emm_context->_security.ul_count; - if (true == ies->is_initial) { + if (ies->is_initial) { emm_context->_security.next_hop_chaining_count = 0; } } @@ -1088,7 +1088,7 @@ static int _send_tau_accept_and_check_for_neaf_flag( ue_context->mme_ue_s1ap_id); OAILOG_FUNC_RETURN(LOG_NAS_EMM, RETURNerror); } - if ((mme_ue_context_get_ue_sgs_neaf(ue_context->mme_ue_s1ap_id) == true)) { + if (mme_ue_context_get_ue_sgs_neaf(ue_context->mme_ue_s1ap_id)) { OAILOG_INFO( LOG_MME_APP, "Sending UE Activity Ind to MSC for ue-id: " MME_UE_S1AP_ID_FMT "\n", diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c index ef444d62304c..95db4e79f0be 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.c @@ -35,7 +35,7 @@ #include "mme_app_ue_context.h" #include "nas/as_message.h" #include "emm_cause.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "emm_as.h" #include "emm_recv.h" #include "LowerLayer.h" @@ -521,17 +521,18 @@ static int _emm_as_recv( } rc = emm_recv_tau_complete(ue_id, &emm_msg->tracking_area_update_complete); - /* - * send the SGSAP TMSI Reallocation complete message towards SGS. - * if csfb newTmsiAllocated flag is true - * After sending set it to false - */ + /* send the SGSAP TMSI Reallocation complete message towards SGS. + * if csfb newTmsiAllocated flag is true + * After sending set it to false + */ if (emm_ctx->csfbparams.newTmsiAllocated) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_tmsi_reallocation_comp(imsi_str, strlen(imsi_str)); emm_ctx->csfbparams.newTmsiAllocated = false; - /* update the neaf flag to false after sending the Tmsi Reallocation Complete message to SGS */ + /* update the neaf flag to false after sending the Tmsi Reallocation + * Complete message to SGS + */ mme_ue_context_update_ue_sgs_neaf(ue_id, false); } break; @@ -1208,6 +1209,10 @@ static int _emm_as_encode( OAILOG_FUNC_IN(LOG_NAS_EMM); int bytes = 0; + /* Ciphering algorithms, EEA1 and EEA2 expects length to be mode of 4, + * so length is modified such that it will be mode of 4 + */ + EMM_GET_BYTE_ALIGNED_LENGTH(length); if (msg->header.security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { emm_msg_header_t *header = &msg->security_protected.plain.emm.header; diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.h b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.h index d28cde07a718..97b9ba762f31 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.h +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_as.h @@ -2,9 +2,9 @@ * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. - * The OpenAirInterface Software Alliance licenses this file to You under + * The OpenAirInterface Software Alliance licenses this file to You under * the Apache License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. + * except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 @@ -45,7 +45,8 @@ Description Defines the EMMAS Service Access Point that provides /****************************************************************************/ /********************* G L O B A L C O N S T A N T S *******************/ /****************************************************************************/ - +#define QUADLET 4 +#define EMM_GET_BYTE_ALIGNED_LENGTH(LENGTH) LENGTH += QUADLET - (LENGTH % QUADLET) /****************************************************************************/ /************************ G L O B A L T Y P E S ************************/ /****************************************************************************/ diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c index e1cfe07dd59b..c614fc7dc2ed 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_cn.c @@ -577,9 +577,7 @@ static int _emm_cn_cs_response_success(emm_cn_cs_response_success_t* msg_pP) memset(&esm_msg, 0, sizeof(ESM_msg)); - if (mme_config.eps_network_feature_support.ims_voice_over_ps_session_in_s1) { - is_standalone = emm_ctx->esm_ctx.is_standalone; - } + is_standalone = emm_ctx->esm_ctx.is_standalone; switch (msg_pP->pdn_type) { case IPv4: diff --git a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c index 55ed9662d2c0..2e486b8d9b25 100644 --- a/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c +++ b/lte/gateway/c/oai/tasks/nas/emm/sap/emm_recv.c @@ -34,7 +34,7 @@ #include "3gpp_requirements_24.301.h" #include "emm_sap.h" #include "service303.h" -#include "nas_itti_messaging.h" +#include "mme_app_itti_messaging.h" #include "conversions.h" #include "3gpp_24.301.h" #include "AdditionalUpdateType.h" @@ -732,7 +732,7 @@ int emm_recv_service_request( if(service_type != CSFB_SERVICE_MT_SMS) { char imsi_str[IMSI_BCD_DIGITS_MAX + 1]; IMSI_TO_STRING(&(emm_ctx->_imsi), imsi_str, IMSI_BCD_DIGITS_MAX + 1); - nas_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); + mme_app_itti_sgsap_ue_activity_ind(imsi_str, strlen(imsi_str)); } mme_ue_context_update_ue_sgs_neaf(ue_id, false); } diff --git a/lte/gateway/c/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.c b/lte/gateway/c/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.c index c379bd3aab36..845a82c9fc33 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.c +++ b/lte/gateway/c/oai/tasks/nas/esm/DefaultEpsBearerContextActivation.c @@ -229,16 +229,11 @@ int esm_proc_default_eps_bearer_context_request( ue_id, ebi); - /* If VoLTE is enabled, send ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST + /* Send ACTIVATE DEFAULT EPS BEARER CONTEXT REQUEST * in ERAB SETUP REQ mesage */ - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - rc = - _default_eps_bearer_activate_in_bearer_setup_req(emm_context, ebi, msg); - OAILOG_FUNC_RETURN(LOG_NAS_ESM, rc); - } - rc = _default_eps_bearer_activate(emm_context, ebi, msg); + rc = + _default_eps_bearer_activate_in_bearer_setup_req(emm_context, ebi, msg); } else { OAILOG_INFO( LOG_NAS_ESM, @@ -526,8 +521,12 @@ static void _default_eps_bearer_activate_t3485_handler(void *args) */ bstring b = bstrcpy(esm_ebr_timer_data->msg); - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { + /* If standalone PDN connectivity request is received send activate + * default eps bearer req message in erab setup req s1ap message. + * If PDN connectivity is received along with attach req send + * activate default eps bearer req message in ICS req + */ + if (((emm_context_t*) esm_ebr_timer_data->ctx)->esm_ctx.is_standalone) { rc = _default_eps_bearer_activate_in_bearer_setup_req( esm_ebr_timer_data->ctx, esm_ebr_timer_data->ebi, &b); } else { diff --git a/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c b/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c index 3a279f619fd9..cb3bd27d246b 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c +++ b/lte/gateway/c/oai/tasks/nas/esm/EpsBearerContextDeactivation.c @@ -515,11 +515,8 @@ static void _eps_bearer_deactivate_t3495_handler(void *args) UE_NOT_RESPONDING); } // Reset is_pdn_disconnect flag - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - if (ue_mm_context->emm_context.esm_ctx.is_pdn_disconnect) { - ue_mm_context->emm_context.esm_ctx.is_pdn_disconnect = false; - } + if (ue_mm_context->emm_context.esm_ctx.is_pdn_disconnect) { + ue_mm_context->emm_context.esm_ctx.is_pdn_disconnect = false; } /* diff --git a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c index 938748510f02..4cb349607ff9 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c +++ b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_recv.c @@ -348,9 +348,7 @@ esm_cause_t esm_recv_pdn_connectivity_request( ue_id); } - if ( - (is_standalone) && - (mme_config.eps_network_feature_support.ims_voice_over_ps_session_in_s1)) { + if (is_standalone) { mme_app_desc_t* mme_app_desc_p = get_mme_nas_state(false); ue_mm_context_t* ue_mm_context_p = mme_ue_context_exists_mme_ue_s1ap_id( &mme_app_desc_p->mme_ue_contexts, ue_id); @@ -365,6 +363,7 @@ esm_cause_t esm_recv_pdn_connectivity_request( LOG_NAS_ESM, "ESM-PROC - Cannot select APN for ue id" MME_UE_S1AP_ID_FMT "\n", ue_id); + unlock_ue_contexts(ue_mm_context_p); OAILOG_FUNC_RETURN(LOG_NAS_ESM, ESM_CAUSE_UNKNOWN_ACCESS_POINT_NAME); } @@ -429,39 +428,11 @@ esm_cause_t esm_recv_pdn_connectivity_request( mme_app_send_s11_create_session_req( mme_app_desc_p, ue_mm_context_p, pdn_cid); unlock_ue_contexts(ue_mm_context_p); - OAILOG_FUNC_RETURN(LOG_NAS_ESM, esm_cause); - } - -#if ORIGINAL_CODE - /* - * Execute the PDN connectivity procedure requested by the UE - */ - int pid = esm_proc_pdn_connectivity_request( - emm_context, - pti, - emm_ctx->esm_ctx.esm_proc_data->request_type, - &esm_data->apn, - esm_data->pdn_type, - &esm_data->pdn_addr, - &esm_data->qos, - &esm_cause); - - if (pid != RETURNerror) { - /* - * Create local default EPS bearer context - */ - int rc = esm_proc_default_eps_bearer_context( - emm_ctx, pid, new_ebi, &esm_data->qos, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } + } else { + mme_app_send_s6a_update_location_req( + PARENT_STRUCT(emm_context, struct ue_mm_context_s, emm_context)); + esm_cause = ESM_CAUSE_SUCCESS; } -#else - mme_app_send_s6a_update_location_req( - PARENT_STRUCT(emm_context, struct ue_mm_context_s, emm_context)); - esm_cause = ESM_CAUSE_SUCCESS; -#endif /* * Return the ESM cause value */ @@ -540,21 +511,19 @@ esm_cause_t esm_recv_pdn_disconnect_request( OAILOG_FUNC_RETURN(LOG_NAS_ESM, ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); } - struct esm_proc_data_s* esm_data = emm_context->esm_ctx.esm_proc_data; - /* Send PDN disconnect reject if there is only one PDN connection*/ if (emm_context->esm_ctx.n_pdns == 1) { OAILOG_FUNC_RETURN( LOG_NAS_ESM, ESM_CAUSE_LAST_PDN_DISCONNECTION_NOT_ALLOWED); } - esm_data->pti = pti; - /* * Message processing */ /* * Execute the PDN disconnect procedure requested by the UE */ + struct esm_proc_data_s* esm_data = emm_context->esm_ctx.esm_proc_data; + esm_data->pti = pti; if (ue_mm_context_p ->bearer_contexts[EBI_TO_INDEX(msg->linkedepsbeareridentity)]) { @@ -588,34 +557,15 @@ esm_cause_t esm_recv_pdn_disconnect_request( OAILOG_FUNC_RETURN(LOG_NAS_ESM, ESM_CAUSE_INVALID_EPS_BEARER_IDENTITY); } - /* If VoLTE is enabled, send ITTI message to MME APP - * MME APP will trigger Delete session towards SGW - * to release the session - */ - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - OAILOG_INFO( - LOG_NAS_ESM, - "ESM-SAP - Sending PDN Disconnect Request message " - "(ue_id=" MME_UE_S1AP_ID_FMT ", pid=%d, ebi=%d)\n", - ue_mm_context_p->mme_ue_s1ap_id, - pid, - msg->linkedepsbeareridentity); - mme_app_send_delete_session_request( - ue_mm_context_p, msg->linkedepsbeareridentity, pid); - OAILOG_FUNC_RETURN(LOG_NAS_ESM, esm_cause); - } - - /* - * Release the associated default EPS bearer context - */ - int bid = 0; - int rc = esm_proc_eps_bearer_context_deactivate( - emm_context, false, msg->linkedepsbeareridentity, &pid, &bid, &esm_cause); - - if (rc != RETURNerror) { - esm_cause = ESM_CAUSE_SUCCESS; - } + OAILOG_INFO( + LOG_NAS_ESM, + "ESM-SAP - Sending Delete session req message " + "(ue_id=" MME_UE_S1AP_ID_FMT ", pid=%d, ebi=%d)\n", + ue_mm_context_p->mme_ue_s1ap_id, + pid, + msg->linkedepsbeareridentity); + mme_app_send_delete_session_request( + ue_mm_context_p, msg->linkedepsbeareridentity, pid); /* * Return the ESM cause value diff --git a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_sap.c b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_sap.c index d1a2092cb2d9..07df733e79d5 100644 --- a/lte/gateway/c/oai/tasks/nas/esm/sap/esm_sap.c +++ b/lte/gateway/c/oai/tasks/nas/esm/sap/esm_sap.c @@ -339,42 +339,6 @@ int esm_sap_send(esm_sap_t *msg) /********************* L O C A L F U N C T I O N S *********************/ /****************************************************************************/ -/**************************************************************************** - ** ** - ** Name: reject_standalone_pdn_conn_req() ** - ** ** - ** Description: Rejects the standalone PDN Connectivity message as there ** - ** is no handling yet ** - ** ** - ** Inputs: pti,pdn_connectivity_reject,esm_procedure ** - ** Others: None ** - ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** Others: NONE ** - ** ** - ***************************************************************************/ - -static int _reject_standalone_pdn_conn_req( - unsigned int pti, - pdn_connectivity_reject_msg *pdn_connectivity_reject, - esm_proc_procedure_t *esm_procedure) -{ - int rc = RETURNok; - int esm_cause = ESM_CAUSE_REQUEST_REJECTED_UNSPECIFIED; - - OAILOG_FUNC_IN(LOG_NAS_ESM); - increment_counter("ue_pdn_connection", 1, 1, "type", "standalone"); - rc = - esm_send_pdn_connectivity_reject(pti, pdn_connectivity_reject, esm_cause); - /* - * Setup the callback function used to send PDN connectivity - */ - *esm_procedure = esm_proc_pdn_connectivity_reject; - - OAILOG_FUNC_RETURN(LOG_NAS_ESM, rc); -} - /**************************************************************************** ** ** ** Name: _esm_sap_recv() ** @@ -691,9 +655,6 @@ static int _esm_sap_recv( case MODIFY_EPS_BEARER_CONTEXT_REJECT: break; case PDN_CONNECTIVITY_REQUEST: { - esm_proc_data_t data; - - memset(&data, 0, sizeof(esm_proc_data_t)); OAILOG_DEBUG( LOG_NAS_ESM, "ESM-SAP - PDN_CONNECTIVITY_REQUEST pti %u ebi %u stand_alone %u " @@ -702,185 +663,34 @@ static int _esm_sap_recv( ebi, is_standalone); - //Process standalone PDN Connectivity Request if VoLTE is enabled - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - esm_cause = esm_recv_pdn_connectivity_request( - emm_context, - pti, - ebi, - &esm_msg.pdn_connectivity_request, - &ebi, - is_standalone); - - if (esm_cause != ESM_CAUSE_SUCCESS) { - /* - * Return reject message - */ - OAILOG_ERROR( - LOG_NAS_ESM, - "ESM-SAP - Sending PDN connectivity reject for ue_id = (%u)\n", - ue_id); - rc = esm_send_pdn_connectivity_reject( - pti, &esm_msg.pdn_connectivity_reject, esm_cause); - /* - * Setup the callback function used to send PDN connectivity - * * * * reject message onto the network - */ - esm_procedure = esm_proc_pdn_connectivity_reject; - /* - * No ESM status message should be returned - */ - esm_cause = ESM_CAUSE_SUCCESS; - } - break; - } - if (is_standalone == true) { - /* Rejecting PDN Connectivity message as there is no code to handle standalone message yet*/ - if ( - RETURNok != - _reject_standalone_pdn_conn_req( - pti, &esm_msg.pdn_connectivity_reject, &esm_procedure)) { - OAILOG_ERROR( - LOG_NAS_ESM, - "ESM-SAP - Could not build PDN_CONNECTIVITY_REJECT message\n"); - } else { - OAILOG_DEBUG( - LOG_NAS_ESM, - "ESM-SAP - Built PDN_CONNECTIVITY_REJECT message\n"); - } - } else { - increment_counter("ue_pdn_connection", 1, 1, "type", "with_attach"); - } - /* - * Process PDN connectivity request message received from the UE - * Do not process if its a standalone message - */ - - if (!is_standalone) { - esm_cause = esm_recv_pdn_connectivity_request( - emm_context, - pti, - ebi, - &esm_msg.pdn_connectivity_request, - &ebi, - is_standalone); - } - OAILOG_DEBUG( - LOG_NAS_ESM, - "ESM-SAP - ESM Message type = PDN_CONNECTIVITY_REQUEST(0x%x)" - "(ESM Cause = %d) for (ue_id = %u)\n", - esm_msg.header.message_type, - esm_cause, - ue_id); + esm_cause = esm_recv_pdn_connectivity_request( + emm_context, + pti, + ebi, + &esm_msg.pdn_connectivity_request, + &ebi, + is_standalone); if (esm_cause != ESM_CAUSE_SUCCESS) { /* * Return reject message */ - OAILOG_ERROR( - LOG_NAS_ESM, - "ESM-SAP - Sending PDN connectivity reject for ue_id = (%u)\n", - ue_id); + OAILOG_ERROR( + LOG_NAS_ESM, + "ESM-SAP - Sending PDN connectivity reject for ue_id = (%u)\n", + ue_id); rc = esm_send_pdn_connectivity_reject( pti, &esm_msg.pdn_connectivity_reject, esm_cause); /* * Setup the callback function used to send PDN connectivity - * * * * reject message onto the network + * * * * reject message to UE */ esm_procedure = esm_proc_pdn_connectivity_reject; /* * No ESM status message should be returned */ esm_cause = ESM_CAUSE_SUCCESS; - } else { -#if ORIGINAL_CODE - /* - * Setup PDN type - */ - int pdn_type = -1; - - if (data.pdn_type == ESM_PDN_TYPE_IPV4) { - pdn_type = PDN_VALUE_TYPE_IPV4; - } else if (data.pdn_type == ESM_PDN_TYPE_IPV6) { - pdn_type = PDN_VALUE_TYPE_IPV6; - } else if (data.pdn_type == ESM_PDN_TYPE_IPV4V6) { - pdn_type = PDN_VALUE_TYPE_IPV4V6; - } - - /* - * Setup EPS bearer level Quality of Service - */ - EpsQualityOfService qos; - - qos.bitRatesPresent = 1; - qos.bitRatesExtPresent = 0; - qos.qci = data.qos.qci; - qos.bitRates.maxBitRateForUL = data.qos.mbrUL; - qos.bitRates.maxBitRateForDL = data.qos.mbrDL; - qos.bitRates.guarBitRateForUL = data.qos.gbrUL; - qos.bitRates.guarBitRateForDL = data.qos.gbrDL; - /* - * Return default EPS bearer context request message - */ - rc = esm_send_activate_default_eps_bearer_context_request( - pti, - ebi, - &esm_msg.activate_default_eps_bearer_context_request, - &data.apn, - pdn_type, - &data.pdn_addr, - &qos, - esm_cause); -#if 0 - PacketFilters pkfs; - - pkfs[0].identifier = 1; - pkfs[0].direction = TRAFFIC_FLOW_TEMPLATE_DOWNLINK_ONLY; - pkfs[0].eval_precedence = 2; - pkfs[0].packetfilter.flags = (TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG | TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG | TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG | TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG); - pkfs[0].packetfilter.ipv4remoteaddr[0].addr = 192; - pkfs[0].packetfilter.ipv4remoteaddr[1].addr = 168; - pkfs[0].packetfilter.ipv4remoteaddr[2].addr = 12; - pkfs[0].packetfilter.ipv4remoteaddr[3].addr = 1; - pkfs[0].packetfilter.ipv4remoteaddr[0].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[1].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[2].mask = 255; - pkfs[0].packetfilter.ipv4remoteaddr[3].mask = 0; - pkfs[0].packetfilter.protocolidentifier_nextheader = 17; - pkfs[0].packetfilter.singlelocalport = 10001; - pkfs[0].packetfilter.singleremoteport = 12001; - pkfs[1].identifier = 2; - pkfs[1].direction = TRAFFIC_FLOW_TEMPLATE_UPLINK_ONLY; - pkfs[1].eval_precedence = 3; - pkfs[1].packetfilter.flags = (TRAFFIC_FLOW_TEMPLATE_IPV4_REMOTE_ADDR_FLAG | TRAFFIC_FLOW_TEMPLATE_PROTOCOL_NEXT_HEADER_FLAG | TRAFFIC_FLOW_TEMPLATE_SINGLE_LOCAL_PORT_FLAG | TRAFFIC_FLOW_TEMPLATE_SINGLE_REMOTE_PORT_FLAG); - pkfs[1].packetfilter.ipv4remoteaddr[0].addr = 192; - pkfs[1].packetfilter.ipv4remoteaddr[1].addr = 168; - pkfs[1].packetfilter.ipv4remoteaddr[2].addr = 12; - pkfs[1].packetfilter.ipv4remoteaddr[3].addr = 1; - pkfs[1].packetfilter.ipv4remoteaddr[0].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[1].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[2].mask = 255; - pkfs[1].packetfilter.ipv4remoteaddr[3].mask = 0; - pkfs[1].packetfilter.protocolidentifier_nextheader = 17; - pkfs[1].packetfilter.singlelocalport = 10002; - pkfs[1].packetfilter.singleremoteport = 12002; - /* - * Return dedicated EPS bearer context request message - */ - rc = esm_send_activate_dedicated_eps_bearer_context_request (pti, ebi, &esm_msg.activate_dedicated_eps_bearer_context_request, ebi, &qos, &pkfs, 2); -#endif - esm_procedure = esm_proc_default_eps_bearer_context_request; -#else - esm_cause = ESM_CAUSE_SUCCESS; -#endif - /* - * Setup the callback function used to send default EPS bearer - * * * * context request message onto the network - */ - //esm_procedure = esm_proc_default_eps_bearer_context_request; } - break; } @@ -914,28 +724,12 @@ static int _esm_sap_recv( */ esm_cause = ESM_CAUSE_SUCCESS; } else { - /* If VoLTE is enabled and UE has sent PDN Disconnect + /* If UE has sent PDN Disconnect * send deactivate_eps_bearer_context_req after * receiving delete session response from SGW */ - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - emm_context->esm_ctx.is_pdn_disconnect = true; - OAILOG_FUNC_RETURN(LOG_NAS_ESM, RETURNok); - } - /* - * Return deactivate EPS bearer context request message - */ - rc = esm_send_deactivate_eps_bearer_context_request( - pti, - ebi, - &esm_msg.deactivate_eps_bearer_context_request, - ESM_CAUSE_REGULAR_DEACTIVATION); - /* - * Setup the callback function used to send deactivate EPS - * * * * bearer context request message onto the network - */ - esm_procedure = esm_proc_eps_bearer_context_deactivate_request; + emm_context->esm_ctx.is_pdn_disconnect = true; + OAILOG_FUNC_RETURN(LOG_NAS_ESM, RETURNok); } break; diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c index d2455d476195..83a8e6852a53 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c +++ b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.c @@ -111,155 +111,3 @@ void s6a_auth_info_rsp_timer_expiry_handler(void *args) OAILOG_FUNC_OUT(LOG_NAS_EMM); } - -void nas_itti_extended_service_req( - const mme_ue_s1ap_id_t ue_id, - const uint8_t servicetype, - uint8_t csfb_response) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, NAS_EXTENDED_SERVICE_REQ); - memset( - &message_p->ittiMsg.nas_extended_service_req, - 0, - sizeof(itti_nas_extended_service_req_t)); - NAS_EXTENDED_SERVICE_REQ(message_p).ue_id = ue_id; - NAS_EXTENDED_SERVICE_REQ(message_p).servType = servicetype; - NAS_EXTENDED_SERVICE_REQ(message_p).csfb_response = csfb_response; - - OAILOG_INFO( - LOG_MME_APP, - "Send NAS_EXTENDED_SERVICE_REQ from Nas to Mme-app for ue_id :%u\n", - ue_id); - itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -void nas_itti_sgsap_uplink_unitdata( - const char *const imsi, - uint8_t imsi_len, - bstring nas_msg, - imeisv_t *imeisv_pP, - MobileStationClassmark2 *mobilestationclassmark2_pP, - tai_t *tai_pP, - ecgi_t *ecgi_pP) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - int uetimezone = 0; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_UPLINK_UNITDATA); - AssertFatal(message_p, "itti_alloc_new_message Failed"); - memset( - &message_p->ittiMsg.sgsap_uplink_unitdata, - 0, - sizeof(itti_sgsap_uplink_unitdata_t)); - memcpy(SGSAP_UPLINK_UNITDATA(message_p).imsi, imsi, imsi_len); - SGSAP_UPLINK_UNITDATA(message_p).imsi[imsi_len] = '\0'; - SGSAP_UPLINK_UNITDATA(message_p).imsi_length = imsi_len; - SGSAP_UPLINK_UNITDATA(message_p).nas_msg_container = nas_msg; - nas_msg = NULL; - /* - * optional - UE Time Zone - * update the ue time zone presence bitmask - */ - if ((uetimezone = get_time_zone()) != RETURNerror) { - SGSAP_UPLINK_UNITDATA(message_p).opt_ue_time_zone = timezone; - SGSAP_UPLINK_UNITDATA(message_p).presencemask = - UPLINK_UNITDATA_UE_TIMEZONE_PARAMETER_PRESENT; - } - /* - * optional - IMEISV - * update the imeisv presence bitmask - */ - if (imeisv_pP) { - hexa_to_ascii( - (uint8_t *) imeisv_pP->u.value, - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv, - 8); - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv[imeisv_pP->length] = '\0'; - SGSAP_UPLINK_UNITDATA(message_p).opt_imeisv_length = imeisv_pP->length; - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_IMEISV_PARAMETER_PRESENT; - } - /* - * optional - mobile station classmark2 - * update the mobile station classmark2 presence bitmask. - */ - if (mobilestationclassmark2_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_mobilestationclassmark2 = - *((MobileStationClassmark2_t *) mobilestationclassmark2_pP); - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_MOBILE_STATION_CLASSMARK_2_PARAMETER_PRESENT; - } - /* - * optional - tai - * update the tai presence bitmask. - */ - if (tai_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_tai = *((tai_t *) tai_pP); - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_TAI_PARAMETER_PRESENT; - } - /* - * optional - ecgi - * update the ecgi presence bitmask. - */ - if (ecgi_pP) { - SGSAP_UPLINK_UNITDATA(message_p).opt_ecgi = *ecgi_pP; - SGSAP_UPLINK_UNITDATA(message_p).presencemask |= - UPLINK_UNITDATA_ECGI_PARAMETER_PRESENT; - } - - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_TMSI_REALLOC_COMP); - memset( - &message_p->ittiMsg.sgsap_tmsi_realloc_comp, - 0, - sizeof(itti_sgsap_tmsi_reallocation_comp_t)); - memcpy(SGSAP_TMSI_REALLOC_COMP(message_p).imsi, imsi, imsi_len); - SGSAP_TMSI_REALLOC_COMP(message_p).imsi[imsi_len] = '\0'; - SGSAP_TMSI_REALLOC_COMP(message_p).imsi_length = imsi_len; - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - - OAILOG_FUNC_OUT(LOG_NAS); -} - -//------------------------------------------------------------------------------ -void nas_itti_sgsap_ue_activity_ind( - const char *imsi, - const unsigned int imsi_len) -{ - OAILOG_FUNC_IN(LOG_NAS); - MessageDef *message_p = NULL; - - message_p = itti_alloc_new_message(TASK_NAS_MME, SGSAP_UE_ACTIVITY_IND); - memset( - &message_p->ittiMsg.sgsap_ue_activity_ind, - 0, - sizeof(itti_sgsap_ue_activity_ind_t)); - memcpy(SGSAP_UE_ACTIVITY_IND(message_p).imsi, imsi, imsi_len); - SGSAP_UE_ACTIVITY_IND(message_p).imsi[imsi_len] = '\0'; - SGSAP_UE_ACTIVITY_IND(message_p).imsi_length = imsi_len; - itti_send_msg_to_task(TASK_SGS, INSTANCE_DEFAULT, message_p); - OAILOG_DEBUG( - LOG_NAS, - " Sending NAS ITTI SGSAP UE ACTIVITY IND to SGS task for Imsi : %s \n", - imsi); - - OAILOG_FUNC_OUT(LOG_NAS); -} diff --git a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h index 5d1c382e56fe..273ddf56a425 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h +++ b/lte/gateway/c/oai/tasks/nas/nas_itti_messaging.h @@ -48,37 +48,11 @@ int nas_itti_dl_data_req( bstring nas_msgP, nas_error_code_t transaction_status); -void nas_itti_extended_service_req( - const mme_ue_s1ap_id_t ue_id, - const uint8_t servicetype, - uint8_t csfb_response); - -void nas_itti_sgsap_uplink_unitdata( - const char *const imsi, - uint8_t imsi_len, - bstring nas_msg, - imeisv_t *imeisv, - MobileStationClassmark2 *mobilestationclassmark2, - tai_t *tai, - ecgi_t *ecgi); - void nas_itti_sgsap_downlink_unitdata( const char *const imsi, uint8_t imsi_len, const_bstring nas_msg); -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len); - -void nas_itti_sgsap_tmsi_reallocation_comp( - const char *imsi, - const unsigned int imsi_len); - void s6a_auth_info_rsp_timer_expiry_handler(void *args); -void nas_itti_sgsap_ue_activity_ind( - const char *imsi, - const unsigned int imsi_len); - #endif /* FILE_NAS_ITTI_MESSAGING_SEEN */ diff --git a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c index 8a0acc83d030..8be300db55ed 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_mme_task.c +++ b/lte/gateway/c/oai/tasks/nas/nas_mme_task.c @@ -62,38 +62,6 @@ static void *nas_intertask_interface(void *args_p) S1AP_DEREGISTER_UE_REQ(received_message_p).mme_ue_s1ap_id); } break; - case SGSAP_DOWNLINK_UNITDATA: { - /* - * We received the Downlink Unitdata from MSC, trigger a - * Downlink Nas Transport message to UE. - */ - nas_proc_downlink_unitdata( - &SGSAP_DOWNLINK_UNITDATA(received_message_p)); - } break; - - case SGSAP_RELEASE_REQ: { - /* - * We received the SGS Release request from MSC,to indicate that there are no more NAS messages to be exchanged - * between the VLR and the UE, or when a further exchange of NAS messages for the specified UE is not possible - * due to an error. - */ - nas_proc_sgs_release_req(&SGSAP_RELEASE_REQ(received_message_p)); - } break; - case SGSAP_MM_INFORMATION_REQ: { - /*Received SGSAP MM Information Request message from SGS task*/ - nas_proc_cs_domain_mm_information_request( - &SGSAP_MM_INFORMATION_REQ(received_message_p)); - } break; - case NAS_CS_SERVICE_NOTIFICATION: { - nas_proc_cs_service_notification( - &NAS_CS_SERVICE_NOTIFICATION(received_message_p)); - } break; - - case NAS_NOTIFY_SERVICE_REJECT: { - nas_proc_notify_service_reject( - &NAS_NOTIFY_SERVICE_REJECT(received_message_p)); - } break; - case TERMINATE_MESSAGE: { put_mme_nas_state(&mme_app_desc_p); nas_exit(); diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.c b/lte/gateway/c/oai/tasks/nas/nas_proc.c index c68e69f263b6..7da154ca2bb0 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.c +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.c @@ -62,6 +62,7 @@ #include "mme_app_state.h" #include "nas_procedures.h" #include "service303.h" +#include "sgs_messages_types.h" /****************************************************************************/ /**************** E X T E R N A L D E F I N I T I O N S ****************/ @@ -783,6 +784,7 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_release_req) emm_context_unlock(ctxt); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } + /**************************************************************************** ** ** ** Name: nas_proc_cs_service_notification() ** @@ -790,16 +792,19 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_release_req) ** Description: Processes CS Paging Request message from MSC/VLR ** ** over SGs interface ** ** ** - ** Inputs: ** - ** cs_service_notification: The received message from MME app ** + ** Inputs: ue_id: UE identifier ** + ** paging_id Indicates the identity used for ** + ** paging non-eps services ** + ** cli Calling Line Identification ** ** ** ** Outputs: ** ** Return: RETURNok, RETURNerror ** ** ** ***************************************************************************/ - int nas_proc_cs_service_notification( - itti_nas_cs_service_notification_t *const cs_service_notification) + mme_ue_s1ap_id_t ue_id, + uint8_t paging_id, + bstring cli) { int rc = RETURNerror; emm_sap_t emm_sap = {0}; @@ -807,14 +812,13 @@ int nas_proc_cs_service_notification( OAILOG_FUNC_IN(LOG_NAS_EMM); emm_sap.primitive = EMMAS_DATA_REQ; emm_sap.u.emm_as.u.data.nas_info = EMM_AS_NAS_DATA_CS_SERVICE_NOTIFICATION; - emm_sap.u.emm_as.u.data.ue_id = cs_service_notification->ue_id; + emm_sap.u.emm_as.u.data.ue_id = ue_id; emm_sap.u.emm_as.u.data.nas_msg = NULL; /*No Esm container*/ - emm_sap.u.emm_as.u.data.paging_identity = cs_service_notification->paging_id; - emm_sap.u.emm_as.u.data.cli = cs_service_notification->cli; + emm_sap.u.emm_as.u.data.paging_identity = paging_id; + bassign(emm_sap.u.emm_as.u.data.cli, cli); rc = emm_sap_send(&emm_sap); if (emm_sap.u.emm_as.u.data.cli) { bdestroy(emm_sap.u.emm_as.u.data.cli); - cs_service_notification->cli = NULL; } OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -912,11 +916,10 @@ static nas_cause_t s6a_error_2_nas_cause(uint32_t s6a_error, int experimental) default: break; } } - return NAS_CAUSE_NETWORK_FAILURE; } -/* Handle CS domain MM-Information request from MSC/VLR */ +// Handle CS domain MM-Information request from MSC/VLR int nas_proc_cs_domain_mm_information_request( itti_sgsap_mm_information_req_t *const mm_information_req_pP) @@ -931,73 +934,6 @@ int nas_proc_cs_domain_mm_information_request( OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } -/**************************************************************************** - ** ** - ** Name: nas_proc_notify_service_reject() ** - ** ** - ** Description: Processes Service Reject notification received from ** - ** MME APP ** - ** ** - ** Inputs: ** - ** service_reject_p : The received message from MME app ** - ** ** - ** Outputs: ** - ** Return: RETURNok, RETURNerror ** - ** ** - ***************************************************************************/ - -int nas_proc_notify_service_reject( - itti_nas_notify_service_reject_t *const service_reject_p) -{ - int rc = RETURNerror; - - OAILOG_FUNC_IN(LOG_NAS_EMM); - DevAssert(service_reject_p); - if ( - service_reject_p->failed_procedure == - INTIAL_CONTEXT_SETUP_PROCEDURE_FAILED) { - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for failed procedure %d for ue-id: %u \n", - service_reject_p->failed_procedure, - service_reject_p->ue_id); - rc = emm_proc_service_reject( - service_reject_p->ue_id, service_reject_p->emm_cause); - } else if ( - service_reject_p->failed_procedure == - UE_CONTEXT_MODIFICATION_PROCEDURE_FAILED) { - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for failed UE_CONTEXT_MODIFICATION procedure for " - "ue-id:%u \n", - service_reject_p->ue_id); - rc = emm_send_service_reject_in_dl_nas( - service_reject_p->ue_id, service_reject_p->emm_cause); - } else if ( - service_reject_p->failed_procedure == - MT_CALL_CANCELLED_BY_NW_IN_IDLE_STATE) { - // If ECM state is IDLE send service_reject in Establish cnf else send in DL NAS Transport - rc = emm_proc_service_reject( - service_reject_p->ue_id, service_reject_p->emm_cause); - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for FAILED_PROCEDURE_MT_CALL_CANCELLED_BY_NW " - "procedure for ue-id:%u \n", - service_reject_p->ue_id); - } else if ( - service_reject_p->failed_procedure == - MT_CALL_CANCELLED_BY_NW_IN_CONNECTED_STATE) { - rc = emm_send_service_reject_in_dl_nas( - service_reject_p->ue_id, service_reject_p->emm_cause); - OAILOG_INFO( - LOG_NAS_EMM, - "Send Service Reject for FAILED_PROCEDURE_MT_CALL_CANCELLED_BY_NW " - "procedure for ue-id:%u \n", - service_reject_p->ue_id); - } - OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); -} - /**************************************************************************** ** ** ** Name: nas_proc_pdn_disconnect_rsp ** diff --git a/lte/gateway/c/oai/tasks/nas/nas_proc.h b/lte/gateway/c/oai/tasks/nas/nas_proc.h index 675b07542db5..5a5fc8e5b3f8 100644 --- a/lte/gateway/c/oai/tasks/nas/nas_proc.h +++ b/lte/gateway/c/oai/tasks/nas/nas_proc.h @@ -144,9 +144,9 @@ int nas_proc_sgs_release_req(itti_sgsap_release_req_t *sgs_rel); int nas_proc_cs_domain_mm_information_request( itti_sgsap_mm_information_req_t *const mm_information_req_pP); int nas_proc_cs_service_notification( - itti_nas_cs_service_notification_t *const cs_service_notification); -int nas_proc_notify_service_reject( - itti_nas_notify_service_reject_t *const service_reject_p); + mme_ue_s1ap_id_t ue_id, + uint8_t paging_id, + bstring cli); int nas_proc_delete_dedicated_bearer( emm_cn_deactivate_dedicated_bearer_req_t *emm_cn_deactivate); int nas_proc_pdn_disconnect_rsp( diff --git a/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c b/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c index ecc420b265cd..a6192bbe1401 100644 --- a/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c +++ b/lte/gateway/c/oai/tasks/sgs/sgs_service_handler.c @@ -151,7 +151,7 @@ int handle_sgs_downlink_unitdata( sgs_dl_unitdata_p, sizeof(itti_sgsap_downlink_unitdata_t)); // send it to NAS module for further processing - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } @@ -169,7 +169,7 @@ int handle_sgs_release_req(const itti_sgsap_release_req_t *sgs_release_req_p) OAILOG_DEBUG(LOG_SGS, "Received SGS Release Request message from FedGW\n"); memcpy(sgs_rel_req_p, sgs_release_req_p, sizeof(itti_sgsap_release_req_t)); // send it to NAS module for further processing - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_NAS_EMM, rc); } /* Fed GW calls below function, on reception of MM Information Request from MSC/VLR @@ -205,7 +205,7 @@ int handle_sgs_mm_information_request( "Imsi :%s \n", mm_information_req_p->imsi); - rc = itti_send_msg_to_task(TASK_NAS_MME, INSTANCE_DEFAULT, message_p); + rc = itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_SGS, rc); } diff --git a/lte/gateway/c/oai/tasks/sgw/sgw_handlers.c b/lte/gateway/c/oai/tasks/sgw/sgw_handlers.c index 91e6db69f268..305c9b8343d6 100644 --- a/lte/gateway/c/oai/tasks/sgw/sgw_handlers.c +++ b/lte/gateway/c/oai/tasks/sgw/sgw_handlers.c @@ -1442,10 +1442,8 @@ int sgw_handle_delete_session_request( delete_session_resp_p->peer_ip.s_addr = delete_session_req_pP->peer_ip.s_addr; - if (mme_config.eps_network_feature_support - .ims_voice_over_ps_session_in_s1) { - delete_session_resp_p->lbi = delete_session_req_pP->lbi; - } + delete_session_resp_p->lbi = delete_session_req_pP->lbi; + rv = itti_send_msg_to_task(TASK_MME, INSTANCE_DEFAULT, message_p); OAILOG_FUNC_RETURN(LOG_SPGW_APP, rv); diff --git a/lte/gateway/c/session_manager/SessionState.cpp b/lte/gateway/c/session_manager/SessionState.cpp index 7a52b7166554..e63ee8616bfd 100644 --- a/lte/gateway/c/session_manager/SessionState.cpp +++ b/lte/gateway/c/session_manager/SessionState.cpp @@ -59,10 +59,14 @@ void SessionState::add_used_credit( CreditKey charging_key; if (session_rules_.get_charging_key_for_rule_id(rule_id, &charging_key)) { + MLOG(MDEBUG) << "Rule " << rule_id << "Rating Group" + << charging_key.rating_group << " Service Indentifier " + << charging_key.service_identifier; charging_pool_.add_used_credit(charging_key, used_tx, used_rx); } std::string monitoring_key; if (session_rules_.get_monitoring_key_for_rule_id(rule_id, &monitoring_key)) { + MLOG(MDEBUG) << "Rule " << rule_id << " Monitoring Key " << monitoring_key; monitor_pool_.add_used_credit(monitoring_key, used_tx, used_rx); } auto session_level_key_p = monitor_pool_.get_session_level_key(); @@ -80,12 +84,8 @@ void SessionState::get_updates_from_charging_pool( // charging updates std::vector charging_updates; charging_pool_.get_updates( - imsi_, - config_.ue_ipv4, - &session_rules_, - &charging_updates, - actions_out); - for (const auto &update : charging_updates) { + imsi_, config_.ue_ipv4, &session_rules_, &charging_updates, actions_out); + for (const auto& update : charging_updates) { auto new_req = update_request_out.mutable_updates()->Add(); new_req->set_session_id(session_id_); new_req->set_request_number(request_number_); @@ -112,12 +112,8 @@ void SessionState::get_updates_from_monitor_pool( // monitor updates std::vector monitor_updates; monitor_pool_.get_updates( - imsi_, - config_.ue_ipv4, - &session_rules_, - &monitor_updates, - actions_out); - for (const auto &update : monitor_updates) { + imsi_, config_.ue_ipv4, &session_rules_, &monitor_updates, actions_out); + for (const auto& update : monitor_updates) { auto new_req = update_request_out.mutable_usage_monitors()->Add(); new_req->set_session_id(session_id_); new_req->set_request_number(request_number_); @@ -184,7 +180,7 @@ void SessionState::complete_termination() charging_pool_.get_termination_updates(&termination); try { on_termination_callback_(termination); - } catch (std::bad_function_call &) { + } catch (std::bad_function_call&) { MLOG(MERROR) << "Missing termination callback function while terminating " "session for IMSI " << imsi_ << " and session id " << session_id_; @@ -213,12 +209,12 @@ bool SessionState::deactivate_static_rule(const std::string& rule_id) return session_rules_.deactivate_static_rule(rule_id); } -ChargingCreditPool &SessionState::get_charging_pool() +ChargingCreditPool& SessionState::get_charging_pool() { return charging_pool_; } -UsageMonitoringCreditPool &SessionState::get_monitor_pool() +UsageMonitoringCreditPool& SessionState::get_monitor_pool() { return monitor_pool_; } @@ -226,17 +222,17 @@ UsageMonitoringCreditPool &SessionState::get_monitor_pool() bool SessionState::is_same_config(const Config& new_config) { return config_.ue_ipv4.compare(new_config.ue_ipv4) == 0 && - config_.spgw_ipv4.compare(new_config.spgw_ipv4) == 0 && - config_.msisdn.compare(new_config.msisdn) == 0 && - config_.apn.compare(new_config.apn) == 0 && - config_.imei.compare(new_config.imei) == 0 && - config_.plmn_id.compare(new_config.plmn_id) == 0 && - config_.imsi_plmn_id.compare(new_config.imsi_plmn_id) == 0 && - config_.user_location.compare(new_config.user_location) == 0 && - config_.rat_type == new_config.rat_type && - config_.hardware_addr.compare(new_config.hardware_addr) == 0 && - config_.radius_session_id.compare(new_config.radius_session_id) == 0 && - config_.bearer_id == new_config.bearer_id; + config_.spgw_ipv4.compare(new_config.spgw_ipv4) == 0 && + config_.msisdn.compare(new_config.msisdn) == 0 && + config_.apn.compare(new_config.apn) == 0 && + config_.imei.compare(new_config.imei) == 0 && + config_.plmn_id.compare(new_config.plmn_id) == 0 && + config_.imsi_plmn_id.compare(new_config.imsi_plmn_id) == 0 && + config_.user_location.compare(new_config.user_location) == 0 && + config_.rat_type == new_config.rat_type && + config_.hardware_addr.compare(new_config.hardware_addr) == 0 && + config_.radius_session_id.compare(new_config.radius_session_id) == 0 && + config_.bearer_id == new_config.bearer_id; } std::string SessionState::get_session_id() diff --git a/lte/gateway/python/magma/enodebd/lte_utils.py b/lte/gateway/python/magma/enodebd/lte_utils.py index a3fd64254e8b..71f17f01593e 100644 --- a/lte/gateway/python/magma/enodebd/lte_utils.py +++ b/lte/gateway/python/magma/enodebd/lte_utils.py @@ -79,15 +79,32 @@ def __init__(self, duplex_mode, earfcndl, start_freq_dl_mhz, 28: LTEBandInfo(DuplexMode.FDD, range(9210, 9660), 758, 27210, 703), # TDD bands # duplex_mode, EARFCNDL, start_freq_dl + 33: LTEBandInfo(DuplexMode.TDD, range(36000, 36199), 1900), + 34: LTEBandInfo(DuplexMode.TDD, range(36200, 36349), 2010), + 35: LTEBandInfo(DuplexMode.TDD, range(36350, 36949), 1850), + 36: LTEBandInfo(DuplexMode.TDD, range(36950, 37549), 1930), + 37: LTEBandInfo(DuplexMode.TDD, range(37550, 37750), 1910), 38: LTEBandInfo(DuplexMode.TDD, range(37750, 38250), 2570), 39: LTEBandInfo(DuplexMode.TDD, range(38250, 38650), 1880), 40: LTEBandInfo(DuplexMode.TDD, range(38650, 39650), 2300), 41: LTEBandInfo(DuplexMode.TDD, range(39650, 41590), 2496), 42: LTEBandInfo(DuplexMode.TDD, range(41590, 43590), 3400), 43: LTEBandInfo(DuplexMode.TDD, range(43590, 45590), 3600), + 44: LTEBandInfo(DuplexMode.TDD, range(45590, 46589), 703), + 45: LTEBandInfo(DuplexMode.TDD, range(46590, 46789), 1447), + 46: LTEBandInfo(DuplexMode.TDD, range(46790, 54539), 5150), + 47: LTEBandInfo(DuplexMode.TDD, range(54540, 55239), 5855), 48: LTEBandInfo(DuplexMode.TDD, range(55240, 56740), 3550), + 49: LTEBandInfo(DuplexMode.TDD, range(56740, 58239), 3550), + 50: LTEBandInfo(DuplexMode.TDD, range(58240, 59089), 1432), + 51: LTEBandInfo(DuplexMode.TDD, range(59090, 59139), 1427), + 52: LTEBandInfo(DuplexMode.TDD, range(59140, 60139), 3300), + # For the band #53 start_freq_dl is float value which require some changes + # in the code + # 53: LTEBandInfo(DuplexMode.TDD, range(60140, 60254), 2483.5), + } -# TODO - add remaining LTE bands +# TODO - add remaining FDD LTE bands def map_earfcndl_to_duplex_mode(earfcndl: int) -> Optional[DuplexMode]: diff --git a/lte/gateway/python/magma/pipelined/app/enforcement_stats.py b/lte/gateway/python/magma/pipelined/app/enforcement_stats.py index 8cfaeb3c7a7b..81bff24c63f8 100644 --- a/lte/gateway/python/magma/pipelined/app/enforcement_stats.py +++ b/lte/gateway/python/magma/pipelined/app/enforcement_stats.py @@ -65,7 +65,6 @@ def __init__(self, *args, **kwargs): # No need to report usage if relay mode is not enabled. self._relay_enabled = kwargs['mconfig'].relay_enabled if not self._relay_enabled: - self.init_finished = True self.logger.info('Relay mode is not enabled. ' 'enforcement_stats will not report usage.') return diff --git a/lte/gateway/python/magma/pipelined/app/policy_mixin.py b/lte/gateway/python/magma/pipelined/app/policy_mixin.py index 5076885120a7..8dfb94df7195 100644 --- a/lte/gateway/python/magma/pipelined/app/policy_mixin.py +++ b/lte/gateway/python/magma/pipelined/app/policy_mixin.py @@ -37,6 +37,10 @@ def __init__(self, *args, **kwargs): self._rule_mapper = kwargs['rule_id_mapper'] self._session_rule_version_mapper = kwargs[ 'session_rule_version_mapper'] + self._relay_enabled = kwargs['mconfig'].relay_enabled + if not self._relay_enabled: + self.logger.info('Relay mode is not enabled, init finished') + self.init_finished = True def setup(self, requests: List[ActivateFlowsRequest], startup_flows: List[OFPFlowStats]) -> SetupFlowsResult: diff --git a/lte/gateway/python/setup.py b/lte/gateway/python/setup.py index fe6b69a17af3..083da521cb64 100644 --- a/lte/gateway/python/setup.py +++ b/lte/gateway/python/setup.py @@ -95,6 +95,7 @@ 'idna==2.8', 'python-dateutil==2.8', 'six>=1.12.0', + 'eventlet!=0.23' ], extras_require={ 'dev': [ diff --git a/lte/protos/abort_session.proto b/lte/protos/abort_session.proto index 26a32ef2a350..cc23c1762392 100644 --- a/lte/protos/abort_session.proto +++ b/lte/protos/abort_session.proto @@ -20,6 +20,7 @@ message AbortSessionResult { SESSION_NOT_FOUND = 1; USER_NOT_FOUND = 2; GATEWAY_NOT_FOUND = 3; + RADIUS_SERVER_ERROR = 4; } Code code = 1; string error_message = 2; diff --git a/orc8r/cloud/configs/metricsd.yml b/orc8r/cloud/configs/metricsd.yml index c1a54e70633a..5b10c44ffe9b 100644 --- a/orc8r/cloud/configs/metricsd.yml +++ b/orc8r/cloud/configs/metricsd.yml @@ -14,5 +14,5 @@ prometheusPushAddresses: prometheusQueryAddress: "http://prometheus:9090" alertmanagerApiURL: "http://alertmanager:9093/api/v2/alerts" -prometheusConfigServiceURL: "http://config-manager:9100" -alertmanagerConfigServiceURL: "http://config-manager:9101" +prometheusConfigServiceURL: "http://prometheus-configurer:9100" +alertmanagerConfigServiceURL: "http://alertmanager-configurer:9101" diff --git a/orc8r/cloud/docker/alertmanager-configurer/Dockerfile b/orc8r/cloud/docker/alertmanager-configurer/Dockerfile new file mode 100644 index 000000000000..a6c1ac7472a8 --- /dev/null +++ b/orc8r/cloud/docker/alertmanager-configurer/Dockerfile @@ -0,0 +1,29 @@ +# Golang image to build prom_alertconfig service +FROM golang:1.13-alpine3.11 as go + +ENV GO111MODULE on +ENV GOBIN /build/bin +ENV PATH ${PATH}:${GOBIN} +# Use public go modules proxy +ENV GOPROXY https://proxy.golang.org + +# Copy go.mod file to cache the downloads +COPY go/go.mod /gomod/ +WORKDIR /gomod +RUN go mod download + +# Copy magma code +COPY go/ /go/src/magma/orc8r/cloud/go/ + +# Build alertmanager_configurer service +WORKDIR /go/src/magma/orc8r/cloud/go/services/metricsd/prometheus/configmanager/alertmanager/ +RUN go build -i -o $GOBIN/alertmanager_configurer + +FROM alpine:3.11 + +COPY --from=go /build/bin/alertmanager_configurer /bin/alertmanager_configurer + +# Copy config files +COPY docker/alertmanager-configurer/configs /etc/configs + +ENTRYPOINT ["alertmanager_configurer"] diff --git a/orc8r/cloud/docker/config-manager/configs/alertmanager.yml b/orc8r/cloud/docker/alertmanager-configurer/configs/alertmanager.yml similarity index 100% rename from orc8r/cloud/docker/config-manager/configs/alertmanager.yml rename to orc8r/cloud/docker/alertmanager-configurer/configs/alertmanager.yml diff --git a/orc8r/cloud/docker/config-manager/Dockerfile b/orc8r/cloud/docker/config-manager/Dockerfile deleted file mode 100644 index 63ae20683a30..000000000000 --- a/orc8r/cloud/docker/config-manager/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -# Golang image to build prom_alertconfig service -FROM golang:1.12 as go - -ENV GO111MODULE on -ENV GOBIN /build/bin -ENV PATH ${PATH}:${GOBIN} -# Use public go modules proxy -ENV GOPROXY https://proxy.golang.org - -# Copy go.mod file to cache the downloads -COPY go/go.mod /gomod/ -WORKDIR /gomod -RUN go mod download - -# Copy magma code -COPY go/ /go/src/magma/orc8r/cloud/go/ - -# Build prom_alertconfig service -WORKDIR /go/src/magma/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/ -RUN go build -i -o $GOBIN/prometheus_configmanager -WORKDIR /go/src/magma/orc8r/cloud/go/services/metricsd/prometheus/configmanager/alertmanager/ -RUN go build -i -o $GOBIN/alertmanager_configmanager - -FROM ubuntu:xenial - -RUN apt-get update && \ - apt-get install -y supervisor - -COPY --from=go /build/bin/prometheus_configmanager /bin/prometheus_configmanager -COPY --from=go /build/bin/alertmanager_configmanager /bin/alertmanager_configmanager - -# Copy config files -COPY docker/config-manager/configs /etc/configs - -COPY docker/config-manager/supervisord.conf /etc/supervisor/conf.d/supervisord.conf -CMD ["/usr/bin/supervisord"] diff --git a/orc8r/cloud/docker/config-manager/supervisord.conf b/orc8r/cloud/docker/config-manager/supervisord.conf deleted file mode 100644 index fda9adfc2daa..000000000000 --- a/orc8r/cloud/docker/config-manager/supervisord.conf +++ /dev/null @@ -1,18 +0,0 @@ -[supervisord] -nodaemon=true - -[program:prom_alertconfig] -command=prometheus_configmanager -port=%(ENV_PROM_ALERTCONFIG_PORT)s -rules-dir=%(ENV_RULES_DIR)s -prometheusURL=%(ENV_PROMETHEUS_URL)s -multitenant=%(ENV_MULTITENANT)s -autorestart=true -stdout_logfile=NONE -stderr_logfile=NONE -stdout_events_enabled = true -stderr_events_enabled = true - -[program:alertmanager_config] -command=alertmanager_configmanager -port=%(ENV_ALERTMANAGER_CONFIG_PORT)s -alertmanager-conf=%(ENV_ALERTMANAGER_CONF_PATH)s -alertmanagerURL=%(ENV_ALERTMANAGER_URL)s -autorestart=true -stdout_logfile=NONE -stderr_logfile=NONE -stdout_events_enabled = true -stderr_events_enabled = true diff --git a/orc8r/cloud/docker/docker-compose.metrics.yml b/orc8r/cloud/docker/docker-compose.metrics.yml index ff9e718b0a7d..01522b418c01 100644 --- a/orc8r/cloud/docker/docker-compose.metrics.yml +++ b/orc8r/cloud/docker/docker-compose.metrics.yml @@ -16,7 +16,7 @@ services: ports: - 9090:9090/tcp volumes: - - $PWD/../../../orc8r/cloud/docker/config-manager/configs:/etc/prometheus:ro + - $PWD/../../../orc8r/cloud/docker/prometheus-configurer/configs:/etc/prometheus:ro command: - '--config.file=/etc/prometheus/prometheus.yml' - '--storage.tsdb.path=/prometheus' @@ -28,23 +28,31 @@ services: ports: - 9093:9093/tcp volumes: - - $PWD/../../../orc8r/cloud/docker/config-manager/configs:/etc/alertmanager:ro + - $PWD/../../../orc8r/cloud/docker/alertmanager-configurer/configs:/etc/alertmanager:ro restart: always - config-manager: + prometheus-configurer: volumes: - - $PWD/../../../orc8r/cloud/docker/config-manager/configs:/etc/configs + - $PWD/../../../orc8r/cloud/docker/prometheus-configurer/configs:/etc/configs build: context: $PWD/../../../orc8r/cloud - dockerfile: $PWD/config-manager/Dockerfile - environment: - - PROM_ALERTCONFIG_PORT=9100 - - RULES_DIR=/etc/configs/alert_rules - - PROMETHEUS_URL=prometheus:9090 - - ALERTMANAGER_CONFIG_PORT=9101 - - ALERTMANAGER_CONF_PATH=/etc/configs/alertmanager.yml - - ALERTMANAGER_URL=alertmanager:9093 - - MULTITENANT=true + dockerfile: $PWD/prometheus-configurer/Dockerfile + command: + - '-port=9100' + - '-rules-dir=/etc/configs/alert_rules' + - '-prometheusURL=prometheus:9090' + restart: always + + alertmanager-configurer: + volumes: + - $PWD/../../../orc8r/cloud/docker/alertmanager-configurer/configs:/etc/configs + build: + context: $PWD/../../../orc8r/cloud + dockerfile: $PWD/alertmanager-configurer/Dockerfile + command: + - '-port=9101' + - '-alertmanager-conf=/etc/configs/alertmanager.yml' + - '-alertmanagerURL=alertmanager:9093' restart: always grafana: diff --git a/orc8r/cloud/docker/prometheus-configurer/Dockerfile b/orc8r/cloud/docker/prometheus-configurer/Dockerfile new file mode 100644 index 000000000000..67e56293abcf --- /dev/null +++ b/orc8r/cloud/docker/prometheus-configurer/Dockerfile @@ -0,0 +1,29 @@ +# Golang image to build prom_alertconfig service +FROM golang:1.13-alpine3.11 as go + +ENV GO111MODULE on +ENV GOBIN /build/bin +ENV PATH ${PATH}:${GOBIN} +# Use public go modules proxy +ENV GOPROXY https://proxy.golang.org + +# Copy go.mod file to cache the downloads +COPY go/go.mod /gomod/ +WORKDIR /gomod +RUN go mod download + +# Copy magma code +COPY go/ /go/src/magma/orc8r/cloud/go/ + +# Build prom_alertconfig service +WORKDIR /go/src/magma/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/ +RUN go build -i -o $GOBIN/prometheus_configurer + +FROM alpine:3.11 + +COPY --from=go /build/bin/prometheus_configurer /bin/prometheus_configurer + +# Copy config files +COPY docker/prometheus-configurer/configs /etc/configs + +ENTRYPOINT ["prometheus_configurer"] diff --git a/orc8r/cloud/docker/config-manager/configs/prometheus.yml b/orc8r/cloud/docker/prometheus-configurer/configs/prometheus.yml similarity index 100% rename from orc8r/cloud/docker/config-manager/configs/prometheus.yml rename to orc8r/cloud/docker/prometheus-configurer/configs/prometheus.yml diff --git a/orc8r/cloud/go/services/metricsd/prometheus/configmanager/alertmanager/docs/swagger.yml b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/alertmanager/docs/swagger.yml new file mode 100644 index 000000000000..274fd6d6a071 --- /dev/null +++ b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/alertmanager/docs/swagger.yml @@ -0,0 +1,283 @@ +--- +swagger: '2.0' +info: + title: Alertmanager Configurer Model Definitions and Paths + description: Alertmanager Configurer REST APIs + version: 0.1.0 + +paths: + /{tenant_id}/alert_receiver: + post: + summary: Create new alert receiver + tags: + - Receivers + parameters: + - $ref: '#/parameters/tenant_id' + - in: body + name: receiver_config + description: Alert receiver that is to be added + required: true + schema: + $ref: '#/definitions/receiver_config' + responses: + '201': + description: Created + default: + $ref: '#/responses/UnexpectedError' + get: + summary: Retrive alert receivers + tags: + - Receivers + parameters: + - $ref: '#/parameters/tenant_id' + responses: + '200': + description: List of alert receivers + schema: + type: array + items: + $ref: '#/definitions/receiver_config' + default: + $ref: '#/responses/UnexpectedError' + delete: + summary: Delete alert receiver + tags: + - Receivers + parameters: + - $ref: '#/parameters/tenant_id' + - in: query + name: receiver + description: Receiver name to be deleted + required: true + type: string + responses: + '200': + description: Deleted + default: + $ref: '#/responses/UnexpectedError' + + /{tenant_id}/receiver/{receiver_name}: + put: + summary: Update existing alert receiver + tags: + - Receivers + parameters: + - $ref: '#/parameters/tenant_id' + - in: path + name: receiver_name + description: Name of receiver to be updated + required: true + type: string + - in: body + name: receiver_config + description: Updated alert receiver + required: true + schema: + $ref: '#/definitions/receiver_config' + responses: + '200': + description: Updated + default: + $ref: '#/responses/UnexpectedError' + + /{tenant_id}/receiver/route: + get: + summary: Retrieve alert routing tree + tags: + - Routes + parameters: + - $ref: '#/parameters/tenant_id' + responses: + '200': + description: Alerting tree + schema: + $ref: '#/definitions/routing_tree' + post: + summary: Modify alert routing tree + tags: + - Routes + parameters: + - $ref: '#/parameters/tenant_id' + - in: body + name: route + description: Alert routing tree to be used + required: true + schema: + $ref: '#/definitions/routing_tree' + responses: + '200': + description: OK + default: + $ref: '#/responses/UnexpectedError' + +parameters: + tenant_id: + description: Tenant ID + in: path + name: tenant_id + required: true + type: string + +definitions: + receiver_config: + type: object + required: + - name + properties: + name: + type: string + slack_configs: + type: array + items: + $ref: '#/definitions/slack_receiver' + + slack_receiver: + type: object + required: + - api_url + properties: + api_url: + type: string + channel: + type: string + username: + type: string + color: + type: string + title: + type: string + pretext: + type: string + text: + type: string + fields: + type: array + items: + $ref: '#/definitions/slack_field' + short_fields: + type: boolean + footer: + type: string + fallback: + type: string + callback_id: + type: string + icon_emoji: + type: string + icon_url: + type: string + image_url: + type: string + thumb_url: + type: string + link_names: + type: boolean + actions: + type: array + items: + $ref: '#/definitions/slack_action' + + slack_field: + type: object + required: + - title + - value + properties: + title: + type: string + value: + type: string + short: + type: boolean + + slack_action: + type: object + required: + - type + - text + - url + properties: + type: + type: string + text: + type: string + url: + type: string + style: + type: string + name: + type: string + value: + type: string + confirm: + $ref: '#/definitions/slack_confirm_field' + + slack_confirm_field: + type: object + required: + - text + - title + - ok_text + - dismiss_text + properties: + text: + type: string + title: + type: string + ok_text: + type: string + dismiss_text: + type: string + + routing_tree: + type: object + required: + - receiver + properties: + receiver: + type: string + group_by: + type: array + items: + type: string + match: + type: object + properties: + label: + type: string + value: + type: string + match_re: + type: object + properties: + label: + type: string + value: + type: string + continue: + type: boolean + routes: + type: array + items: + $ref: '#/definitions/routing_tree' + group_wait: + type: string + group_interval: + type: string + repeat_interval: + type: string + + error: + type: object + required: + - message + properties: + message: + example: Error string + type: string + +responses: + UnexpectedError: + description: Unexpected Error + schema: + $ref: '#/definitions/error' diff --git a/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/docs/swagger.yml b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/docs/swagger.yml new file mode 100644 index 000000000000..a06455ce473b --- /dev/null +++ b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/docs/swagger.yml @@ -0,0 +1,164 @@ +--- +swagger: '2.0' +info: + title: Prometheus Configurer Model Definitions and Paths + description: Prometheus Configurer REST APIs + version: 0.1.0 + +paths: + /{tenant_id}/alert: + get: + summary: Retrieve alerting rule configurations + parameters: + - $ref: '#/parameters/tenant_id' + - in: query + name: alert_name + type: string + description: Optional name of alert to retrieve + required: false + responses: + '200': + description: + List of alert configurations + schema: + type: array + items: + $ref: '#/definitions/alert_config' + default: + $ref: '#/responses/UnexpectedError' + post: + summary: Configure alerting rule + parameters: + - $ref: '#/parameters/tenant_id' + - in: body + name: alert_config + description: Alerting rule that is to be added + required: true + schema: + $ref: '#/definitions/alert_config' + responses: + '201': + description: Created + default: + $ref: '#/responses/UnexpectedError' + delete: + summary: Delete an alerting rule + parameters: + - $ref: '#/parameters/tenant_id' + - in: query + name: alert_name + description: Name of alert to be deleted + required: true + type: string + responses: + '200': + description: Deleted + default: + $ref: '#/responses/UnexpectedError' + + /{tenant_id}/alert/{alert_name}: + put: + summary: Update an existing alerting rule + parameters: + - $ref: '#/parameters/tenant_id' + - in: path + name: alert_name + description: Name of alert to be updated + required: true + type: string + - in: body + name: alert_config + description: Updated alerting rule + required: true + schema: + $ref: '#/definitions/alert_config' + responses: + '200': + description: Updated + default: + $ref: '#/responses/UnexpectedError' + + /{tenant_id}/alert/bulk: + put: + summary: Bulk update/create alerting rules + parameters: + - $ref: '#/parameters/tenant_id' + - in: body + name: alert_configs + description: Alerting rules to be updated or created + required: true + schema: + $ref: '#/definitions/alert_config_list' + responses: + '200': + description: Success + schema: + $ref: '#/definitions/alert_bulk_upload_response' + default: + $ref: '#/responses/UnexpectedError' + +parameters: + tenant_id: + description: Tenant ID + in: path + name: tenant_id + required: true + type: string + +definitions: + alert_config: + type: object + required: + - alert + - expr + properties: + alert: + type: string + expr: + type: string + labels: + $ref: '#/definitions/alert_labels' + for: + type: string + annotations: + $ref: '#/definitions/alert_labels' + + alert_config_list: + type: array + items: + $ref: '#/definitions/alert_config' + + alert_bulk_upload_response: + type: object + required: + - errors + - statuses + properties: + errors: + type: object + additionalProperties: + type: string + statuses: + type: object + additionalProperties: + type: string + + alert_labels: + type: object + additionalProperties: + type: string + + error: + type: object + required: + - message + properties: + message: + example: Error string + type: string + +responses: + UnexpectedError: + description: Unexpected Error + schema: + $ref: '#/definitions/error' diff --git a/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/server.go b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/server.go index 0e8290694a93..b390bdd50b4e 100644 --- a/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/server.go +++ b/orc8r/cloud/go/services/metricsd/prometheus/configmanager/prometheus/server.go @@ -47,6 +47,7 @@ func main() { e.POST(AlertPath, GetConfigureAlertHandler(alertClient)) e.GET(AlertPath, GetRetrieveAlertHandler(alertClient)) e.DELETE(AlertPath, GetDeleteAlertHandler(alertClient)) + e.PUT(AlertUpdatePath, GetUpdateAlertHandler(alertClient)) e.PUT(AlertBulkPath, GetBulkAlertUpdateHandler(alertClient)) diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.deployment.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.deployment.yaml new file mode 100644 index 000000000000..ebf6d318d151 --- /dev/null +++ b/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.deployment.yaml @@ -0,0 +1,66 @@ +{{/* +Copyright (c) 2018-present, Facebook, Inc. +All rights reserved. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. An additional grant +of patent rights can be found in the PATENTS file in the same directory. +*/}} +{{- if .Values.alertmanagerConfigurer.create }} +{{- $serviceName := print .Release.Name "-alertmanager-configurer" -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $serviceName }} + labels: + app.kubernetes.io/component: alertmanager-configurer +{{ include "metrics.labels" . | indent 4 }} +spec: + replicas: {{ .Values.alertmanagerConfigurer.replicas }} + selector: + matchLabels: + app.kubernetes.io/component: alertmanager-configurer +{{ include "selector-labels" . | indent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: alertmanager-configurer +{{ include "selector-labels" . | indent 8 }} + spec: + {{- with .Values.alertmanagerConfigurer.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.alertmanagerConfigurer.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.alertmanagerConfigurer.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml . | trimSuffix "\n" | indent 8 }} + {{- end }} + + volumes: + - name: "prometheus-config" +{{ toYaml .Values.metrics.volumes.prometheusConfig.volumeSpec | indent 10 }} + + containers: + - name: "alertmanager-configurer" + image: {{ required "alertmanagerConfigurer.image.repository must be provided" .Values.alertmanagerConfigurer.image.repository }}:{{ .Values.alertmanagerConfigurer.image.tag }} + imagePullPolicy: {{ .Values.alertmanagerConfigurer.image.pullPolicy }} + ports: + - containerPort: 9101 + volumeMounts: + - name: "prometheus-config" + mountPath: /etc/configs + args: + - "-port={{ .Values.alertmanagerConfigurer.alertmanagerConfigPort }}" + - "-alertmanager-conf={{ .Values.alertmanagerConfigurer.alertmanagerConfPath }}" + - "-alertmanagerURL={{ .Values.alertmanagerConfigurer.alertmanagerURL }}" + resources: +{{ toYaml .Values.alertmanagerConfigurer.resources | indent 12 }} +{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.service.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.service.yaml new file mode 100644 index 000000000000..d64640e86e0a --- /dev/null +++ b/orc8r/cloud/helm/orc8r/charts/metrics/templates/alertmanager-configurer.service.yaml @@ -0,0 +1,46 @@ +{{/* +Copyright (c) 2018-present, Facebook, Inc. +All rights reserved. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. An additional grant +of patent rights can be found in the PATENTS file in the same directory. +*/}} +{{- if .Values.alertmanagerConfigurer.create }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-alertmanager-configurer + labels: + app.kubernetes.io/component: alertmanager-configurer +{{ include "metrics.labels" . | indent 4 }} + {{- with .Values.alertmanagerConfigurer.service.labels }} +{{ toYaml . | indent 4}} + {{- end}} + {{- with .Values.alertmanagerConfigurer.service.annotations }} + annotations: +{{ toYaml . | indent 4}} + {{- end }} +spec: + selector: + app.kubernetes.io/component: alertmanager-configurer +{{ include "selector-labels" . | indent 4 }} + type: {{ .Values.alertmanagerConfigurer.service.type }} + ports: +{{- range $port := .Values.alertmanagerConfigurer.service.ports }} + - name: {{ $port.name }} + port: {{ $port.port }} + targetPort: {{ $port.targetPort }} +{{- end }} +{{- if eq .Values.alertmanagerConfigurer.service.type "LoadBalancer" }} + {{- if .Values.alertmanagerConfigurer.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.alertmanagerConfigurer.service.loadBalancerIP }} + {{- end -}} + {{- if .Values.alertmanagerConfigurer.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range .Values.alertmanagerConfigurer.service.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} + {{- end -}} +{{- end -}} +{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.deployment.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.deployment.yaml deleted file mode 100644 index e31f8d4cbfc4..000000000000 --- a/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.deployment.yaml +++ /dev/null @@ -1,76 +0,0 @@ -{{/* -Copyright (c) 2018-present, Facebook, Inc. -All rights reserved. - -This source code is licensed under the BSD-style license found in the -LICENSE file in the root directory of this source tree. An additional grant -of patent rights can be found in the PATENTS file in the same directory. -*/}} -{{- if .Values.configmanager.create }} -{{- $serviceName := print .Release.Name "-configmanager" -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ $serviceName }} - labels: - app.kubernetes.io/component: configmanager -{{ include "metrics.labels" . | indent 4 }} -spec: - replicas: {{ .Values.configmanager.replicas }} - selector: - matchLabels: - app.kubernetes.io/component: configmanager -{{ include "selector-labels" . | indent 6 }} - template: - metadata: - labels: - app.kubernetes.io/component: configmanager -{{ include "selector-labels" . | indent 8 }} - spec: - {{- with .Values.configmanager.nodeSelector }} - nodeSelector: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.configmanager.tolerations }} - tolerations: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.configmanager.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} - {{- with .Values.imagePullSecrets }} - imagePullSecrets: -{{ toYaml . | trimSuffix "\n" | indent 8 }} - {{- end }} - - volumes: - - name: "prometheus-config" -{{ toYaml .Values.metrics.volumes.prometheusConfig.volumeSpec | indent 10 }} - - containers: - - name: "config-manager" - image: {{ required "configmanager.image.repository must be provided" .Values.configmanager.image.repository }}:{{ .Values.configmanager.image.tag }} - imagePullPolicy: {{ .Values.configmanager.image.pullPolicy }} - ports: - - containerPort: 9100 - - containerPort: 9101 - volumeMounts: - - name: "prometheus-config" - mountPath: /etc/configs - env: - - name: PROM_ALERTCONFIG_PORT - value: {{ .Values.configmanager.environment.promAlertconfigPort | quote }} - - name: RULES_DIR - value: {{ .Values.configmanager.environment.rulesDir | quote }} - - name: PROMETHEUS_URL - value: {{ .Values.configmanager.environment.prometheusURL | quote }} - - name: ALERTMANAGER_CONFIG_PORT - value: {{ .Values.configmanager.environment.alertmanagerConfigPort | quote }} - - name: ALERTMANAGER_CONF_PATH - value: {{ .Values.configmanager.environment.alertmanagerConfPath | quote }} - - name: ALERTMANAGER_URL - value: {{ .Values.configmanager.environment.alertmanagerURL | quote }} - resources: -{{ toYaml .Values.configmanager.resources | indent 12 }} -{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.service.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.service.yaml deleted file mode 100644 index b203175fb0ed..000000000000 --- a/orc8r/cloud/helm/orc8r/charts/metrics/templates/config-manager.service.yaml +++ /dev/null @@ -1,46 +0,0 @@ -{{/* -Copyright (c) 2018-present, Facebook, Inc. -All rights reserved. - -This source code is licensed under the BSD-style license found in the -LICENSE file in the root directory of this source tree. An additional grant -of patent rights can be found in the PATENTS file in the same directory. -*/}} -{{- if .Values.configmanager.create }} -apiVersion: v1 -kind: Service -metadata: - name: {{ .Release.Name }}-configmanager - labels: - app.kubernetes.io/component: configmanager -{{ include "metrics.labels" . | indent 4 }} - {{- with .Values.configmanager.service.labels }} -{{ toYaml . | indent 4}} - {{- end}} - {{- with .Values.configmanager.service.annotations }} - annotations: -{{ toYaml . | indent 4}} - {{- end }} -spec: - selector: - app.kubernetes.io/component: configmanager -{{ include "selector-labels" . | indent 4 }} - type: {{ .Values.configmanager.service.type }} - ports: -{{- range $port := .Values.configmanager.service.ports }} - - name: {{ $port.name }} - port: {{ $port.port }} - targetPort: {{ $port.targetPort }} -{{- end }} -{{- if eq .Values.configmanager.service.type "LoadBalancer" }} - {{- if .Values.configmanager.service.loadBalancerIP }} - loadBalancerIP: {{ .Values.configmanager.service.loadBalancerIP }} - {{- end -}} - {{- if .Values.configmanager.service.loadBalancerSourceRanges }} - loadBalancerSourceRanges: - {{- range .Values.configmanager.service.loadBalancerSourceRanges }} - - {{ . }} - {{- end }} - {{- end -}} -{{- end -}} -{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.deployment.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.deployment.yaml new file mode 100644 index 000000000000..0d739cb971c5 --- /dev/null +++ b/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.deployment.yaml @@ -0,0 +1,67 @@ +{{/* +Copyright (c) 2018-present, Facebook, Inc. +All rights reserved. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. An additional grant +of patent rights can be found in the PATENTS file in the same directory. +*/}} +{{- if .Values.prometheusConfigurer.create }} +{{- $serviceName := print .Release.Name "-prometheus-configurer" -}} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ $serviceName }} + labels: + app.kubernetes.io/component: prometheus-configurer +{{ include "metrics.labels" . | indent 4 }} +spec: + replicas: {{ .Values.prometheusConfigurer.replicas }} + selector: + matchLabels: + app.kubernetes.io/component: prometheus-configurer +{{ include "selector-labels" . | indent 6 }} + template: + metadata: + labels: + app.kubernetes.io/component: prometheus-configurer +{{ include "selector-labels" . | indent 8 }} + spec: + {{- with .Values.prometheusConfigurer.nodeSelector }} + nodeSelector: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.prometheusConfigurer.tolerations }} + tolerations: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.prometheusConfigurer.affinity }} + affinity: +{{ toYaml . | indent 8 }} + {{- end }} + {{- with .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml . | trimSuffix "\n" | indent 8 }} + {{- end }} + + volumes: + - name: "prometheus-config" +{{ toYaml .Values.metrics.volumes.prometheusConfig.volumeSpec | indent 10 }} + + containers: + - name: "prometheus-configurer" + image: {{ required "prometheusConfigurer.image.repository must be provided" .Values.prometheusConfigurer.image.repository }}:{{ .Values.prometheusConfigurer.image.tag }} + imagePullPolicy: {{ .Values.prometheusConfigurer.image.pullPolicy }} + ports: + - containerPort: 9100 + volumeMounts: + - name: "prometheus-config" + mountPath: /etc/configs + args: + - "-port={{ .Values.prometheusConfigurer.prometheusConfigurerPort }}" + - "-rules-dir={{ .Values.prometheusConfigurer.rulesDir }}" + - "-prometheusURL={{ .Values.prometheusConfigurer.prometheusURL }}" + - "-multitenant=true" + resources: +{{ toYaml .Values.prometheusConfigurer.resources | indent 12 }} +{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.service.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.service.yaml new file mode 100644 index 000000000000..37493f7f79d5 --- /dev/null +++ b/orc8r/cloud/helm/orc8r/charts/metrics/templates/prometheus-configurer.service.yaml @@ -0,0 +1,46 @@ +{{/* +Copyright (c) 2018-present, Facebook, Inc. +All rights reserved. + +This source code is licensed under the BSD-style license found in the +LICENSE file in the root directory of this source tree. An additional grant +of patent rights can be found in the PATENTS file in the same directory. +*/}} +{{- if .Values.prometheusConfigurer.create }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Release.Name }}-prometheus-configurer + labels: + app.kubernetes.io/component: prometheus-configurer +{{ include "metrics.labels" . | indent 4 }} + {{- with .Values.prometheusConfigurer.service.labels }} +{{ toYaml . | indent 4}} + {{- end}} + {{- with .Values.prometheusConfigurer.service.annotations }} + annotations: +{{ toYaml . | indent 4}} + {{- end }} +spec: + selector: + app.kubernetes.io/component: prometheus-configurer +{{ include "selector-labels" . | indent 4 }} + type: {{ .Values.prometheusConfigurer.service.type }} + ports: +{{- range $port := .Values.prometheusConfigurer.service.ports }} + - name: {{ $port.name }} + port: {{ $port.port }} + targetPort: {{ $port.targetPort }} +{{- end }} +{{- if eq .Values.prometheusConfigurer.service.type "LoadBalancer" }} + {{- if .Values.prometheusConfigurer.service.loadBalancerIP }} + loadBalancerIP: {{ .Values.prometheusConfigurer.service.loadBalancerIP }} + {{- end -}} + {{- if .Values.prometheusConfigurer.service.loadBalancerSourceRanges }} + loadBalancerSourceRanges: + {{- range .Values.prometheusConfigurer.service.loadBalancerSourceRanges }} + - {{ . }} + {{- end }} + {{- end -}} +{{- end -}} +{{- end }} diff --git a/orc8r/cloud/helm/orc8r/charts/metrics/values.yaml b/orc8r/cloud/helm/orc8r/charts/metrics/values.yaml index a8b9dba33316..ec2481eaab68 100644 --- a/orc8r/cloud/helm/orc8r/charts/metrics/values.yaml +++ b/orc8r/cloud/helm/orc8r/charts/metrics/values.yaml @@ -91,7 +91,7 @@ alertmanager: - prometheus topologyKey: "kubernetes.io/hostname" -configmanager: +prometheusConfigurer: # Enable/Disable chart create: true @@ -105,17 +105,49 @@ configmanager: - name: prom-configmanager port: 9100 targetPort: 9100 + + prometheusConfigurerPort: 9100 + rulesDir: "/etc/configs/alert_rules" + prometheusURL: "orc8r-prometheus:9090" + + image: + repository: + tag: + pullPolicy: IfNotPresent + + resources: {} + nodeSelector: {} + tolerations: [] + # Pod affinity must be used to ensure that this pod runs on same node as prometheus + affinity: + podAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + - labelSelector: + matchExpressions: + - key: app.kubernetes.io/component + operator: In + values: + - prometheus + topologyKey: "kubernetes.io/hostname" + +alertmanagerConfigurer: + # Enable/Disable chart + create: true + + replicas: 1 + + service: + annotations: {} + labels: {} + type: ClusterIP + ports: - name: alertmanager-config port: 9101 targetPort: 9101 - environment: - promAlertconfigPort: "9100" - rulesDir: "/etc/configs/alert_rules" - prometheusURL: "orc8r-prometheus:9090" - alertmanagerConfigPort: "9101" - alertmanagerConfPath: "/etc/configs/alertmanager.yml" - alertmanagerURL: "orc8r-alertmanager:9093" + alertmanagerConfigPort: 9101 + alertmanagerConfPath: "/etc/configs/alertmanager.yml" + alertmanagerURL: "orc8r-alertmanager:9093" image: repository: diff --git a/orc8r/cloud/helm/orc8r/values.yaml b/orc8r/cloud/helm/orc8r/values.yaml index 496b7e5610ec..625d9f8a7977 100644 --- a/orc8r/cloud/helm/orc8r/values.yaml +++ b/orc8r/cloud/helm/orc8r/values.yaml @@ -40,7 +40,9 @@ metrics: create: false alertmanager: create: false - configmanager: + alertmanagerConfigurer: + create: false + prometheusConfigurer: create: false # secrets sub-chart configuration. diff --git a/orc8r/tools/ansible/roles/gateway_services/files/magma.service b/orc8r/tools/ansible/roles/gateway_services/files/magma.service index 314b5ec3bbdc..f97a486aca7b 100644 --- a/orc8r/tools/ansible/roles/gateway_services/files/magma.service +++ b/orc8r/tools/ansible/roles/gateway_services/files/magma.service @@ -11,6 +11,7 @@ Description=Magma %i service Type=simple EnvironmentFile=/etc/environment ExecStart=/usr/bin/env python3 -m magma.%i.main +ExecStopPost=/usr/bin/env python3 /usr/local/bin/service_util.py %i StandardOutput=syslog StandardError=syslog SyslogIdentifier=%i diff --git a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js index 20f84b3d614b..1e3048f17f87 100644 --- a/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js +++ b/symphony/app/fbcnms-packages/fbcnms-alarms/components/rules/PrometheusEditor/PrometheusEditor.js @@ -25,6 +25,7 @@ import {Labels} from '../../prometheus/PromQL'; import {Parse} from '../../prometheus/PromQLParser'; import {SEVERITY} from '../../Severity'; import {useEnqueueSnackbar} from '@fbcnms/ui/hooks/useSnackbar'; +import {useForm} from '../../hooks'; import {useRouter} from '@fbcnms/ui/hooks'; import type {AlertConfig} from '../../AlarmAPIType'; @@ -170,10 +171,27 @@ export default function PrometheusEditor(props: PrometheusEditorProps) { const {apiUtil, isNew, onRuleUpdated, onExit, rule} = props; const {match} = useRouter(); const enqueueSnackbar = useEnqueueSnackbar(); - const [formState, setFormState] = React.useState( - fromAlertConfig(rule ? rule.rawRule : null), + + /** + * after the user types into the form, map back from FormState and + * notify the parent component + */ + const handleFormUpdated = React.useCallback( + (state: FormState) => { + const updatedConfig = toAlertConfig(state); + onRuleUpdated({ + ...rule, + ...({rawRule: updatedConfig}: $Shape>), + }); + }, + [onRuleUpdated, rule], ); + const {formState, handleInputChange, updateFormState} = useForm({ + initialState: fromAlertConfig(rule ? rule.rawRule : null), + onFormUpdated: handleFormUpdated, + }); + const { advancedEditorMode, setAdvancedEditorMode, @@ -190,15 +208,12 @@ export default function PrometheusEditor(props: PrometheusEditorProps) { */ const handleEditorBaseChange = React.useCallback( editorBaseState => { - setFormState({ - ...formState, - ...{ - ruleName: editorBaseState.name, - description: editorBaseState.description, - }, + updateFormState({ + ruleName: editorBaseState.name, + description: editorBaseState.description, }); }, - [formState, setFormState], + [updateFormState], ); const saveAlert = async () => { @@ -231,47 +246,13 @@ export default function PrometheusEditor(props: PrometheusEditorProps) { } }; - /** - * Passes the event value to an updater function which returns an update - * object to be merged into the form. After the internal form state is - * updated, the parent component is notified of the updated AlertConfig - */ - const handleInputChange = React.useCallback( - (formUpdate: (val: string) => $Shape) => ( - event: SyntheticInputEvent, - ) => { - const value = event.target.value; - const updatedForm = { - ...formState, - ...formUpdate(value), - }; - setFormState(updatedForm); - const updatedConfig = toAlertConfig(updatedForm); - onRuleUpdated({ - ...rule, - ...({rawRule: updatedConfig}: $Shape>), - }); - }, - [formState, onRuleUpdated, rule], - ); - - // TODO: pull out common functionality between this and handleInputChange const updateThresholdExpression = React.useCallback( (expression: ThresholdExpression) => { setThresholdExpression(expression); const stringExpression = thresholdToPromQL(expression); - const updatedForm = { - ...formState, - expression: stringExpression, - }; - setFormState(updatedForm); - const updatedConfig = toAlertConfig(updatedForm); - onRuleUpdated({ - ...rule, - ...({rawRule: updatedConfig}: $Shape>), - }); + updateFormState({expression: stringExpression}); }, - [formState, onRuleUpdated, rule, setThresholdExpression], + [setThresholdExpression, updateFormState], ); const severityOptions = React.useMemo>( diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/FormField.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/FormField.js index bad5732634ad..89ebf928e514 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/FormField.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/FormField.js @@ -12,7 +12,6 @@ import type {WithStyles} from '@material-ui/core'; import * as React from 'react'; import Text from './design-system/Text'; -import Typography from '@material-ui/core/Typography'; import {withStyles} from '@material-ui/core/styles'; @@ -45,17 +44,9 @@ class FormField extends React.Component { {label}: - {typeof value === 'string' || typeof value === 'number' ? ( - - {value} - - ) : ( - value - )} + + {value} + ); } diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/Tokenizer.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/Tokenizer.js index 6fa263e46cb7..47530a55d420 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/Tokenizer.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/Tokenizer.js @@ -78,8 +78,8 @@ const styles = { type SearchSource = 'Options' | 'UserInput'; export type Entry = { - id: string, - label: string, + +id: string, + +label: string, }; const autoSuggestStyles = (theme: Theme, searchSource: SearchSource) => ({ diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BaseContexualLayer.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BaseContexualLayer.js index 7c9d1b655b75..acc7eb2b7e8b 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BaseContexualLayer.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BaseContexualLayer.js @@ -20,9 +20,11 @@ const useStyles = makeStyles({ }, }); +export type ContextualLayerPosition = 'below' | 'above'; + export type ContextualLayerOptions = $ReadOnly<{| align?: 'middle', - position?: 'below' | 'above', + position?: ContextualLayerPosition, |}>; type PositionRect = { diff --git a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BasePopoverTrigger.js b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BasePopoverTrigger.js index e1fdc773a711..bd42f0852593 100644 --- a/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BasePopoverTrigger.js +++ b/symphony/app/fbcnms-packages/fbcnms-ui/components/design-system/ContexualLayer/BasePopoverTrigger.js @@ -8,6 +8,7 @@ * @format */ +import type {ContextualLayerPosition} from './BaseContexualLayer'; import type {TRefCallbackFor} from '../types/TRefFor.flow'; import * as React from 'react'; @@ -20,12 +21,14 @@ import {useCallback, useRef, useState} from 'react'; type Props = { children: ( onShow: () => void, + onHide: () => void, contextRef: TRefCallbackFor, ) => React.Node, popover: React.Node, + position?: ContextualLayerPosition, }; -const BasePopoverTrigger = ({children, popover}: Props) => { +const BasePopoverTrigger = ({children, popover, position = 'below'}: Props) => { const [isVisible, setIsVisible] = useState(false); const contextRef = useRef(null); @@ -47,11 +50,11 @@ const BasePopoverTrigger = ({children, popover}: Props) => { return ( <> - {children(onShow, refCallback)} + {children(onShow, onHide, refCallback)} {contextRef.current != null ? (