APN resources was added as a part of this proposal.
https://docs.magmacore.org/docs/next/proposals/p003_qos_enforcement.
apn:
# A template for configuring APN with string name
# used as key and rest of the parameters are packed
# as APN configuration
type: object
required:
- apn_name
- apn_configuration
properties:
apn_name:
$ref: '#/definitions/apn_name'
apn_configuration:
$ref: '#/definitions/apn_configuration'
apn_configuration:
# APN configuration for the default service
# that APN provides
type: object
required:
- ambr
- qos_profile
properties:
ambr:
$ref: '#/definitions/aggregated_maximum_bitrate'
qos_profile:
$ref: '#/definitions/qos_profile'
mutable_lte_gateway:
type: object
description: LTE gateway object with read-only fields omitted
required:
- device
- id
- name
- description
- magmad
- tier
- cellular
- connected_enodeb_serials
properties:
device:
$ref: './orc8r-swagger.yml#/definitions/gateway_device'
id:
$ref: './orc8r-swagger-common.yml#/definitions/gateway_id'
name:
$ref: './orc8r-swagger-common.yml#/definitions/gateway_name'
description:
$ref: './orc8r-swagger-common.yml#/definitions/gateway_description'
magmad:
$ref: './orc8r-swagger.yml#/definitions/magmad_gateway_configs'
tier:
$ref: './orc8r-swagger.yml#/definitions/tier_id'
cellular:
$ref: '#/definitions/gateway_cellular_configs'
connected_enodeb_serials:
$ref: '#/definitions/enodeb_serials'
apn_resources:
$ref: '#/definitions/apn_resources'
APN Resource
apn_resource:
type: object
required:
- id
- apn_name
properties:
id:
description: APN resource ID must be unique across all gateways in a network
type: string
minLength: 1
x-nullable: false
apn_name:
$ref: '#/definitions/apn_name'
vlan_id:
type: integer
format: uint32
gateway_ip:
type: string
format: ipv4
gateway_mac:
type: string
format: mac
/lte/{network_id}/apns/{apn_name}:
get:
summary: Retrieve the APN info
tags:
- APNs
parameters:
- $ref: './orc8r-swagger-common.yml#/parameters/network_id'
- $ref: '#/parameters/apn_name'
responses:
'200':
description: APN Info
schema:
$ref: '#/definitions/apn'
default:
$ref: './orc8r-swagger-common.yml#/responses/UnexpectedError'
put:
summary: Update an existing APN in the network
tags:
- APNs
parameters:
- $ref: './orc8r-swagger-common.yml#/parameters/network_id'
- $ref: '#/parameters/apn_name'
- in: body
name: apn
description: New APN configuration
required: true
schema:
$ref: '#/definitions/apn'
responses:
'204':
description: Success
default:
$ref: './orc8r-swagger-common.yml#/responses/UnexpectedError'
delete:
summary: Remove an APN from the network
tags:
- APNs
parameters:
- $ref: './orc8r-swagger-common.yml#/parameters/network_id'
- $ref: '#/parameters/apn_name'
responses:
'204':
description: Success
default:
$ref: './orc8r-swagger-common.yml#/responses/UnexpectedError'
APN Configuration (configured through APN API)
apn:
# A template for configuring APN with string name
# used as key and rest of the parameters are packed
# as APN configuration
type: object
required:
- apn_name
- apn_configuration
properties:
apn_name:
$ref: '#/definitions/apn_name'
apn_configuration:
$ref: '#/definitions/apn_configuration'
apn_configuration:
# APN configuration for the default service
# that APN provides
type: object
required:
- ambr
- qos_profile
properties:
ambr:
$ref: '#/definitions/aggregated_maximum_bitrate'
qos_profile:
$ref: '#/definitions/qos_profile'
mutable_subscriber:
description: Subset of subscriber field which are mutable
type: object
required:
- id
- lte
properties:
id:
$ref: './lte-policydb-swagger.yml#/definitions/subscriber_id'
name:
type: string
description: 'Name for the subscriber'
example: 'Jane Doe'
lte:
$ref: '#/definitions/lte_subscription'
active_base_names:
$ref: './lte-policydb-swagger.yml#/definitions/base_names'
static_ips:
$ref: '#/definitions/subscriber_static_ips'
active_policies:
$ref: './lte-policydb-swagger.yml#/definitions/policy_ids'
active_policies_by_apn:
$ref: './lte-policydb-swagger.yml#/definitions/policy_ids_by_apn'
active_apns:
$ref: '#/definitions/apn_list'
Subscriber Entity Associations
Subscriber MConfig
func subscriberToMconfig(ent configurator.NetworkEntity, apnConfigs map[string]*lte_models.ApnConfiguration, apnResources lte_models.ApnResources) (*lte_protos.SubscriberData, error) {
sub := <e_protos.SubscriberData{}
t, err := lte_protos.SidProto(ent.Key)
if err != nil {
return nil, err
}
sub.Sid = t
if ent.Config == nil {
return sub, nil
}
cfg := ent.Config.(*models.SubscriberConfig)
sub.Lte = <e_protos.LTESubscription{
State: lte_protos.LTESubscription_LTESubscriptionState(lte_protos.LTESubscription_LTESubscriptionState_value[cfg.Lte.State]),
AuthAlgo: lte_protos.LTESubscription_LTEAuthAlgo(lte_protos.LTESubscription_LTEAuthAlgo_value[cfg.Lte.AuthAlgo]),
AuthKey: cfg.Lte.AuthKey,
AuthOpc: cfg.Lte.AuthOpc,
}
if cfg.Lte.SubProfile != "" {
sub.SubProfile = string(cfg.Lte.SubProfile)
} else {
sub.SubProfile = "default"
}
for _, assoc := range ent.ParentAssociations {
if assoc.Type == lte.BaseNameEntityType {
sub.Lte.AssignedBaseNames = append(sub.Lte.AssignedBaseNames, assoc.Key)
} else if assoc.Type == lte.PolicyRuleEntityType {
sub.Lte.AssignedPolicies = append(sub.Lte.AssignedPolicies, assoc.Key)
}
}
// Construct the non-3gpp profile
non3gpp := <e_protos.Non3GPPUserProfile{
ApnConfig: make([]*lte_protos.APNConfiguration, 0, len(ent.Associations)),
}
for _, assoc := range ent.Associations {
apnConfig, apnFound := apnConfigs[assoc.Key]
if !apnFound {
continue
}
var apnResource *lte_protos.APNConfiguration_APNResource
if apnResourceModel, ok := apnResources[assoc.Key]; ok {
apnResource = apnResourceModel.ToProto()
}
apnProto := <e_protos.APNConfiguration{
ServiceSelection: assoc.Key,
Ambr: <e_protos.AggregatedMaximumBitrate{
MaxBandwidthUl: *(apnConfig.Ambr.MaxBandwidthUl),
MaxBandwidthDl: *(apnConfig.Ambr.MaxBandwidthDl),
},
QosProfile: <e_protos.APNConfiguration_QoSProfile{
ClassId: *(apnConfig.QosProfile.ClassID),
PriorityLevel: *(apnConfig.QosProfile.PriorityLevel),
PreemptionCapability: *(apnConfig.QosProfile.PreemptionCapability),
PreemptionVulnerability: *(apnConfig.QosProfile.PreemptionVulnerability),
},
Resource: apnResource,
}
if staticIP, found := cfg.StaticIps[assoc.Key]; found {
apnProto.AssignedStaticIp = string(staticIP)
}
non3gpp.ApnConfig = append(non3gpp.ApnConfig, apnProto)
}
sort.Slice(non3gpp.ApnConfig, func(i, j int) bool {
return non3gpp.ApnConfig[i].ServiceSelection < non3gpp.ApnConfig[j].ServiceSelection
})
sub.Non_3Gpp = non3gpp
return sub, nil
}
message SubscriberData {
// sid is the unique identifier for the subscriber.
SubscriberID sid = 1;
GSMSubscription gsm = 2;
LTESubscription lte = 3;
magma.orc8r.NetworkID network_id = 4;
SubscriberState state = 5;
string sub_profile = 6;
Non3GPPUserProfile non_3gpp = 7;
}
message Non3GPPUserProfile {
string msisdn = 1;
enum Non3GPPIPAccess {
// Subscriber has non-3GPP subscription access to EPC network
NON_3GPP_SUBSCRIPTION_ALLOWED = 0;
// Subscriber has no non-3GPP subscription access to EPC network
NON_3GPP_SUBSCRIPTION_BARRED = 1;
}
Non3GPPIPAccess non_3gpp_ip_access = 2;
enum Non3GPPIPAccessAPN {
// Enable all APNs for a subscriber
NON_3GPP_APNS_ENABLE = 0;
// Disable all APNs for a subscriber
NON_3GPP_APNS_DISABLE = 1;
}
Non3GPPIPAccessAPN non_3gpp_ip_access_apn = 3;
AggregatedMaximumBitrate ambr = 4;
repeated APNConfiguration apn_config = 5;
AccessNetworkIdentifier access_net_id = 6;
}
message APNConfiguration {
// APN identifier
uint32 context_id = 1;
// Contains either the APN Name or wildcard "*"
string service_selection = 2;
// APN QoS profile
QoSProfile qos_profile = 3;
// APN authorized bitrate
AggregatedMaximumBitrate ambr = 4;
enum PDNType {
IPV4 = 0;
IPV6 = 1;
IPV4V6 = 2;
IPV4_OR_IPV6 = 3;
}
PDNType pdn = 5;
// Optional static IP to allocate for this subscriber on this APN
string assigned_static_ip = 6;
// For details about values see 29.212
message QoSProfile {
int32 class_id = 1;
uint32 priority_level = 2;
bool preemption_capability = 3;
bool preemption_vulnerability = 4;
}
message APNResource {
string apn_name = 1;
string gateway_ip = 2;
string gateway_mac = 3;
uint32 vlan_id = 4;
}
// resource is gateway-specific guidance for serving the APN
APNResource resource = 7;
}
func (m *MutableSubscriber) GetAssocs() []storage.TypeAndKey {
var assocs []storage.TypeAndKey
assocs = append(assocs, m.ActivePoliciesByApn.ToTKs(string(m.ID))...)
assocs = append(assocs, m.ActiveApns.ToTKs()...)
assocs = append(assocs, m.ActivePolicies.ToTKs()...)
assocs = append(assocs, m.ActiveBaseNames.ToTKs()...)
return assocs
}