Описание сервиса
Eltex-johnny - это сервис, реализующий API для управляемого предоставления услуги Wi-Fi. При помощи данного сервиса можно создать, редактировать и удалить портального пользователя извне системы SoftWLC. Так же при помощи данного сервиса можно регулировать блокировку услуги Wi-Fi для определенного клиента или для всего сервисного домена полностью, используя НЛС прикреплённого к сервисному домену внутри системы SoftWLC.
Конфигурация
Конфигурационный файл сервиса располагается по адресу /etc/eltex-johnny/application.conf
pcrf { // connection host host = localhost // connection port (7070 is default) port = 7070 // timeout (you can use ns, us, ms, s, m and h letters) // consult with HOCON duration format for more information timeout = 10s // pool configuration pool { // minimum idle objects in pool min = 1 // maximum pool size max = 20 // timeout to retrieve an object from pool waitTimeout = 5s } } mercury { // connection host host = localhost // connection port (6565 is default) port = 6565 // pool configuration pool { // minimum idle objects in pool min = 1 // maximum pool size max = 20 // timeout to retrieve an object from pool waitTimeout = 5s } } nbi { // connection host host = localhost // connection port (8080 is default) port = 8080 // timeout (you can use ns, us, ms, s, m and h letters) // consult with HOCON duration format for more information timeout = 80s // NBI login login = admin // NBI password password = password // pool configuration pool { // minimum idle objects in pool min = 1 // maximum pool size max = 20 // timeout to retrieve an object from pool waitTimeout = 5s } } portal { scheme = http host = localhost port = 9000 } doors { host = localhost port = 9097 path = /api username = user password = password } http { connectionTimeout = 20s connectionTotal = 100 } // JWT validation. You need a key from Eltex Doors. // Or you could generate it yourself. validation { public_key = /etc/eltex-doors/keys/public.pem }
- Блок настроек pcrf - настройка адреса и порта сервиса eltex-pcrf, количества объектов в пуле запросов, времени ожидания для извлечения объекта из пула.
- Блок настроек mercury - настройка адреса и порта сервиса eltex-mercury, количества объектов в пуле запросов, времени ожидания для извлечения объекта из пула.
- Блок настроек nbi - настройка адреса, порта и учётной записи для взаимодействия с сервисом nbi, количества объектов в пуле запросов, времени ожидания для извлечения объекта из пула.
- Блок настроек portal - настройка схемы, адреса и порта сервиса eltex-portal.
- Блок настроек doors - настройка адреса, порта, пути к API и учётной записи для взаимодействия с сервисом eltex-doors.
- Блок настроек http - настройка таймаута и количества коннектов к API.
- Блок настроек validation - настройка пути расположения публичного ключа сервиса eltex-doors, для проверки валидности токена доступа в систему
Файл настройки логирования /etc/eltex-johnny/log4j2.xml
Файл настройки инициализации сервиса /etc/default/eltex-johnny
PORT=9100 # Initial size of Java heap JAVA_INIT_HEAP=64m # Maximum size of Java heap JAVA_MAX_HEAP=256m # Additional arguments to pass to java JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/eltex-johnny"
где настраивается порт, на котором запускается сервис и количество выделенной ему оперативной памяти.
Общая схема взаимодействия
Подробная схема взаимодействия (B2C)
Описание API сервиса в формате Open API (для схемы B2C)
openapi: "3.0.1" info: title: OSS Interaction Service API version: "1.0" components: securitySchemes: JwtAuth: type: http scheme: bearer bearerFormat: JWT schemas: username: type: integer description: 'Имя пользователя (номер телефона). Может иметь длину от 7 до 15 символов' example: '79123456789' maxLength: 15 minLength: 7 domain: type: string description: 'Домен (область видимости), в котором создан пользователь. Каждый блок может иметь длину от 1 до 63 символов и состоять из латинских букв и/или цифр, также допустимы символы: _ и -. Общая длина не более 235 символов.' example: "root.hello.world" maxLength: 235 minLength: 1 pattern: '(?=^.{1,235}$)(^((?!-|_|.*(__|--).*)[a-zA-Z0-9_-]{1,63}.)*((?!-|_|.*(__|--).*)[a-zA-Z0-9_-]{1,63})$)' User: type: object properties: username: $ref: '#/components/schemas/username' domain: $ref: '#/components/schemas/domain' User_attrs: type: object properties: tariff_code: type: string description: 'Код тарифа пользователя. Соответствующий тариф должен присутствовать в системе. Может состоять из латинских букв и/или цифр до 64-х символов.' maxLength: 64 minLength: 1 pattern: '[a-zA-Z0-9]\{1,64}' locked: type: boolean description: 'Флаг блокировки пользователя. true — заблокирован, false — разблокирован.' User_full: type: object allOf: - $ref: '#/components/schemas/User' - $ref: '#/components/schemas/User_attrs' - type: object Error: type: object properties: description: type: string description: Описание ошибки. requestBodies: # user without attrs (only username and domain) User: content: application/json: schema: $ref: '#/components/schemas/User' description: Объект пользователя без атрибутов. # full user information, including username, domain, lock and tariff code User_full: content: application/json: schema: $ref: '#/components/schemas/User_full' description: Полный объект пользователя. required: true # user attributes only (tariff code and lock value) User_attrs: content: application/json: schema: $ref: '#/components/schemas/User_attrs' description: Объект атрибутов пользователя. required: true responses: 200: description: Успешная операция. Вовзращает только имя пользователя и его домен. content: application/json: schema: $ref: '#/components/schemas/User_full' 200_full: description: Успешная операция. Вовзращает полный объект пользователя. content: application/json: schema: $ref: '#/components/schemas/User_full' 400: description: Неправильное имя пользователя или домен. content: 'application/json': schema: $ref: '#/components/schemas/Error' 403: description: Доступ запрещён content: 'application/json': schema: $ref: '#/components/schemas/Error' 404: description: Пользователь с таким именем и/или доменом не существует или URL неверный. 500: description: Внутренняя ошибка. content: 'application/json': schema: $ref: '#/components/schemas/Error' security: - JwtAuth: [] tags: - name: users description: API управления пользователями. paths: /api/users/new: post: tags: - users summary: Создать нового пользователя requestBody: $ref: '#/components/requestBodies/User_full' responses: 200: $ref: "#/components/responses/200_full" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 404: $ref: "#/components/responses/404" /api/users/{username}@{domain}: parameters: - name: username in: path required: true schema: $ref: '#/components/schemas/username' - name: domain in: path required: true schema: $ref: '#/components/schemas/domain' put: tags: - users summary: Изменить параметры пользователя. requestBody: $ref: '#/components/requestBodies/User_attrs' responses: 200: $ref: "#/components/responses/200_full" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 404: $ref: "#/components/responses/404" delete: tags: - users summary: Удалить пользователя. В URL запроса указывается username и домен. responses: 200: $ref: "#/components/responses/200" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 404: $ref: "#/components/responses/404"
Подробная схема взаимодействия (B2B)
Описание API сервиса в формате Open API (для схемы B2B)
openapi: "3.0.1" info: title: OSS Interaction Service API version: "1.0" components: securitySchemes: JwtAuth: type: http scheme: bearer bearerFormat: JWT schemas: account_id: type: integer description: Номер лицевого счёта клиента (НЛС). maxLength: 12 minLength: 12 locked: type: boolean description: Флаг блокировки счёта клиента (НЛС). account_properties: type: object properties: locked: $ref: '#/components/schemas/locked' Response: type: object properties: locked: $ref: '#/components/schemas/locked' account_id: $ref: '#/components/schemas/account_id' Error: type: object properties: description: type: string description: Описание ошибки. requestBodies: # user without attrs (only username and domain) account_properties: content: application/json: schema: $ref: '#/components/schemas/account_properties' description: Параметры клиента. responses: 200: description: Успешная операция. Вовзращает параметры клиента. content: application/json: schema: $ref: '#/components/schemas/Response' 400: description: Формат НЛС неверный. content: 'application/json': schema: $ref: '#/components/schemas/Error' 403: description: Доступ запрещён. content: 'application/json': schema: $ref: '#/components/schemas/Error' 404: description: Такой НЛС не существует. 500: description: Внутренняя ошибка. content: 'application/json': schema: $ref: '#/components/schemas/Error' security: - JwtAuth: [] tags: - name: clients description: API для управления клиентами. paths: /api/clients/{account_id}: put: tags: - clients summary: Изменить параметры клиента с данным НЛС. parameters: - in: path name: account_id required: true schema: $ref: '#/components/schemas/account_id' requestBody: $ref: '#/components/requestBodies/account_properties' responses: 200: $ref: "#/components/responses/200" 400: $ref: "#/components/responses/400" 403: $ref: "#/components/responses/403" 404: $ref: "#/components/responses/404"