Merge "Add free5GC CNF on VM samples"

This commit is contained in:
Zuul
2022-03-04 04:50:21 +00:00
committed by Gerrit Code Review
35 changed files with 9757 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
heat_template_version: 2013-05-23
description: 'Simple Base HOT for Sample VNF'
parameters:
nfv:
type: json
resources:
master_instance_group:
type: OS::Heat::AutoScalingGroup
properties:
min_size: 1
max_size: 1
desired_capacity: 1
resource:
type: base_hot_nested_master.yaml
properties:
flavor: { get_param: [ nfv, VDU, masterNode, flavor ] }
image: { get_param: [ nfv, VDU, masterNode, image ] }
net1: { get_param: [ nfv, CP, masterNode_CP1, network ] }
worker_instance_group:
type: OS::Heat::AutoScalingGroup
properties:
min_size: 1
max_size: 2
desired_capacity: 1
resource:
type: base_hot_nested_worker.yaml
properties:
flavor: { get_param: [ nfv, VDU, workerNode, flavor ] }
image: { get_param: [ nfv, VDU, workerNode, image ] }
net1: { get_param: [ nfv, CP, workerNode_CP1, network ] }
net2: { get_param: [ nfv, CP, workerNode_CP2, network ] }
net3: { get_param: [ nfv, CP, workerNode_CP3, network ] }
net4: { get_param: [ nfv, CP, workerNode_CP4, network ] }
worker_instance_scale_out:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: 1
auto_scaling_group_id:
get_resource: worker_instance_group
adjustment_type: change_in_capacity
worker_instance_scale_in:
type: OS::Heat::ScalingPolicy
properties:
scaling_adjustment: -1
auto_scaling_group_id:
get_resource: worker_instance_group
adjustment_type: change_in_capacity
outputs: {}

View File

@@ -0,0 +1,26 @@
heat_template_version: 2013-05-23
description: 'masterNode HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
net1:
type: string
resources:
masterNode:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
name: masterNode
image: { get_param: image }
networks:
- port:
get_resource: masterNode_CP1
masterNode_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }

View File

@@ -0,0 +1,53 @@
heat_template_version: 2013-05-23
description: 'workerNode HOT for Sample VNF'
parameters:
flavor:
type: string
image:
type: string
net1:
type: string
net2:
type: string
net3:
type: string
net4:
type: string
resources:
workerNode:
type: OS::Nova::Server
properties:
flavor: { get_param: flavor }
name: workerNode
image: { get_param: image }
networks:
- port:
get_resource: workerNode_CP1
- port:
get_resource: workerNode_CP2
- port:
get_resource: workerNode_CP3
- port:
get_resource: workerNode_CP4
workerNode_CP1:
type: OS::Neutron::Port
properties:
network: { get_param: net1 }
workerNode_CP2:
type: OS::Neutron::Port
properties:
network: { get_param: net2 }
workerNode_CP3:
type: OS::Neutron::Port
properties:
network: { get_param: net3 }
workerNode_CP4:
type: OS::Neutron::Port
properties:
network: { get_param: net4 }

View File

@@ -0,0 +1,202 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: ETSI NFV SOL 001 common types definitions version 2.6.1
metadata:
template_name: etsi_nfv_sol001_common_types
template_author: ETSI_NFV
template_version: 2.6.1
data_types:
tosca.datatypes.nfv.L2AddressData:
derived_from: tosca.datatypes.Root
description: Describes the information on the MAC addresses to be assigned to a connection point.
properties:
mac_address_assignment:
type: boolean
description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
tosca.datatypes.nfv.L3AddressData:
derived_from: tosca.datatypes.Root
description: Provides information about Layer 3 level addressing scheme and parameters applicable to a CP
properties:
ip_address_assignment:
type: boolean
description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
floating_ip_activated:
type: boolean
description: Specifies if the floating IP scheme is activated on the Connection Point or not
required: true
ip_address_type:
type: string
description: Defines address type. The address type should be aligned with the address type supported by the layer_protocols properties of the parent VnfExtCp
required: false
constraints:
- valid_values: [ ipv4, ipv6 ]
number_of_ip_address:
type: integer
description: Minimum number of IP addresses to be assigned
required: false
constraints:
- greater_than: 0
tosca.datatypes.nfv.AddressData:
derived_from: tosca.datatypes.Root
description: Describes information about the addressing scheme and parameters applicable to a CP
properties:
address_type:
type: string
description: Describes the type of the address to be assigned to a connection point. The content type shall be aligned with the address type supported by the layerProtocol property of the connection point
required: true
constraints:
- valid_values: [ mac_address, ip_address ]
l2_address_data:
type: tosca.datatypes.nfv.L2AddressData
description: Provides the information on the MAC addresses to be assigned to a connection point.
required: false
l3_address_data:
type: tosca.datatypes.nfv.L3AddressData
description: Provides the information on the IP addresses to be assigned to a connection point
required: false
tosca.datatypes.nfv.ConnectivityType:
derived_from: tosca.datatypes.Root
description: describes additional connectivity information of a virtualLink
properties:
layer_protocols:
type: list
description: Identifies the protocol a virtualLink gives access to (ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire).The top layer protocol of the virtualLink protocol stack shall always be provided. The lower layer protocols may be included when there are specific requirements on these layers.
required: true
entry_schema:
type: string
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
flow_pattern:
type: string
description: Identifies the flow pattern of the connectivity
required: false
constraints:
- valid_values: [ line, tree, mesh ]
tosca.datatypes.nfv.LinkBitrateRequirements:
derived_from: tosca.datatypes.Root
description: describes the requirements in terms of bitrate for a virtual link
properties:
root:
type: integer # in bits per second
description: Specifies the throughput requirement in bits per second of the link (e.g. bitrate of E-Line, root bitrate of E-Tree, aggregate capacity of E-LAN).
required: true
constraints:
- greater_or_equal: 0
leaf:
type: integer # in bits per second
description: Specifies the throughput requirement in bits per second of leaf connections to the link when applicable to the connectivity type (e.g. for E-Tree and E LAN branches).
required: false
constraints:
- greater_or_equal: 0
tosca.datatypes.nfv.CpProtocolData:
derived_from: tosca.datatypes.Root
description: Describes and associates the protocol layer that a CP uses together with other protocol and connection point information
properties:
associated_layer_protocol:
type: string
required: true
description: One of the values of the property layer_protocols of the CP
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
address_data:
type: list
description: Provides information on the addresses to be assigned to the CP
entry_schema:
type: tosca.datatypes.nfv.AddressData
required: false
tosca.datatypes.nfv.VnfProfile:
derived_from: tosca.datatypes.Root
description: describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF.
properties:
instantiation_level:
type: string
description: Identifier of the instantiation level of the VNF DF to be used for instantiation. If not present, the default instantiation level as declared in the VNFD shall be used.
required: false
min_number_of_instances:
type: integer
description: Minimum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
required: true
constraints:
- greater_or_equal: 0
max_number_of_instances:
type: integer
description: Maximum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
required: true
constraints:
- greater_or_equal: 0
tosca.datatypes.nfv.Qos:
derived_from: tosca.datatypes.Root
description: describes QoS data for a given VL used in a VNF deployment flavour
properties:
latency:
type: scalar-unit.time #Number
description: Specifies the maximum latency
required: true
constraints:
- greater_than: 0 s
packet_delay_variation:
type: scalar-unit.time #Number
description: Specifies the maximum jitter
required: true
constraints:
- greater_or_equal: 0 s
packet_loss_ratio:
type: float
description: Specifies the maximum packet loss ratio
required: false
constraints:
- in_range: [ 0.0, 1.0 ]
capability_types:
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
description: A node type that includes the VirtualLinkable capability indicates that it can be pointed by tosca.relationships.nfv.VirtualLinksTo relationship type
relationship_types:
tosca.relationships.nfv.VirtualLinksTo:
derived_from: tosca.relationships.DependsOn
description: Represents an association relationship between the VduCp and VnfVirtualLink node types
valid_target_types: [ tosca.capabilities.nfv.VirtualLinkable ]
node_types:
tosca.nodes.nfv.Cp:
derived_from: tosca.nodes.Root
description: Provides information regarding the purpose of the connection point
properties:
layer_protocols:
type: list
description: Identifies which protocol the connection point uses for connectivity purposes
required: true
entry_schema:
type: string
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
role: #Name in ETSI NFV IFA011 v0.7.3: cpRole
type: string
description: Identifies the role of the port in the context of the traffic flow patterns in the VNF or parent NS
required: false
constraints:
- valid_values: [ root, leaf ]
description:
type: string
description: Provides human-readable information on the purpose of the connection point
required: false
protocol:
type: list
description: Provides information on the addresses to be assigned to the connection point(s) instantiated from this Connection Point Descriptor
required: false
entry_schema:
type: tosca.datatypes.nfv.CpProtocolData
trunk_mode:
type: boolean
description: Provides information about whether the CP instantiated from this Cp is in Trunk mode (802.1Q or other), When operating in "trunk mode", the Cp is capable of carrying traffic for several VLANs. Absence of this property implies that trunkMode is not configured for the Cp i.e. It is equivalent to boolean value "false".
required: false

View File

@@ -0,0 +1,236 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Simple deployment flavour for Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- sample_free5gc_cnf_on_vm_types.yaml
topology_template:
inputs:
id:
type: string
vendor:
type: string
version:
type: version
descriptor_id:
type: string
descriptor_version:
type: string
provider:
type: string
product_name:
type: string
software_version:
type: string
vnfm_info:
type: list
entry_schema:
type: string
flavour_id:
type: string
flavour_description:
type: string
substitution_mappings:
node_type: company.provider.VNF
properties:
flavour_id: simple
requirements:
virtual_link_external1_1: [ masterNode_CP1, virtual_link ]
virtual_link_external1_2: [ workerNode_CP1, virtual_link ]
virtual_link_external1_3: [ workerNode_CP2, virtual_link ]
virtual_link_external1_4: [ workerNode_CP3, virtual_link ]
virtual_link_external1_5: [ workerNode_CP4, virtual_link ]
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_description: A simple flavour
interfaces:
Vnflcm:
instantiate_end:
implementation: mgmt-drivers-kubernetes-free5gc
terminate_end:
implementation: mgmt-drivers-kubernetes-free5gc
scale_start:
implementation: mgmt-drivers-kubernetes-free5gc
scale_end:
implementation: mgmt-drivers-kubernetes-free5gc
heal_start:
implementation: mgmt-drivers-kubernetes-free5gc
heal_end:
implementation: mgmt-drivers-kubernetes-free5gc
artifacts:
mgmt-drivers-kubernetes-free5gc:
description: Management driver for kubernetes cluster
type: tosca.artifacts.Implementation.Python
file: Scripts/kubernetes_mgmt_free5gc.py
masterNode:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: masterNode
description: masterNode compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 1
sw_image_data:
name: free5gc-master_img
version: '20.04'
checksum:
algorithm: sha-512
hash: d0741bf24b8c9bac3c5bbd13a016ddcd291467b573b43f236fa82affa4bf11538ddde02481ba7767196eb2d8571b747c52b20a27cea03fe2496b0faaf10d6491
container_format: bare
disk_format: qcow2
min_disk: 0 GB
size: 2 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.medium
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 4 GB
virtual_cpu:
num_virtual_cpu: 2
virtual_local_storage:
- size_of_storage: 45 GB
workerNode:
type: tosca.nodes.nfv.Vdu.Compute
properties:
name: workerNode
description: workerNode compute node
vdu_profile:
min_number_of_instances: 1
max_number_of_instances: 2
sw_image_data:
name: free5gc-worker-img
version: '20.04'
checksum:
algorithm: sha-512
hash: f489d48ea08fc10bbf96a33bbc3dbe620fda0138825aa41b3770ab67461993f162e39af5f0d3ceba398fc9cddeb76795f823673bec2affb63a24ba31f4d824ac
container_format: bare
disk_format: qcow2
min_disk: 0 GB
size: 2 GB
capabilities:
virtual_compute:
properties:
requested_additional_capabilities:
properties:
requested_additional_capability_name: m1.xlarge
support_mandatory: true
target_performance_parameters:
entry_schema: test
virtual_memory:
virtual_mem_size: 8 GB
virtual_cpu:
num_virtual_cpu: 8
virtual_local_storage:
- size_of_storage: 160 GB
masterNode_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: masterNode
workerNode_CP1:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: workerNode
workerNode_CP2:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: workerNode
workerNode_CP3:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: workerNode
workerNode_CP4:
type: tosca.nodes.nfv.VduCp
properties:
layer_protocols: [ ipv4 ]
order: 0
requirements:
- virtual_binding: workerNode
policies:
- scaling_aspects:
type: tosca.policies.nfv.ScalingAspects
properties:
aspects:
worker_instance:
name: worker_instance_aspect
description: worker_instance scaling aspect
max_scale_level: 1
step_deltas:
- delta_1
- workerNode_initial_delta:
type: tosca.policies.nfv.VduInitialDelta
properties:
initial_delta:
number_of_instances: 1
targets: [ workerNode ]
- workerNode_scaling_aspect_deltas:
type: tosca.policies.nfv.VduScalingAspectDeltas
properties:
aspect: worker_instance
deltas:
delta_1:
number_of_instances: 1
targets: [ workerNode ]
- instantiation_levels:
type: tosca.policies.nfv.InstantiationLevels
properties:
levels:
instantiation_level_1:
description: Smallest size
scale_info:
worker_instance:
scale_level: 0
instantiation_level_2:
description: Largest size
scale_info:
worker_instance:
scale_level: 1
default_level: instantiation_level_1
- workerNode_instantiation_levels:
type: tosca.policies.nfv.VduInstantiationLevels
properties:
levels:
instantiation_level_1:
number_of_instances: 1
instantiation_level_2:
number_of_instances: 2
targets: [ workerNode ]

View File

@@ -0,0 +1,31 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: Sample VNF.
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- sample_free5gc_cnf_on_vm_types.yaml
- sample_free5gc_cnf_on_vm_df_simple.yaml
topology_template:
inputs:
selected_flavour:
type: string
description: VNF deployment flavour selected by the consumer. It is provided in the API
node_templates:
VNF:
type: company.provider.VNF
properties:
flavour_id: { get_input: selected_flavour }
descriptor_id: 75ebb928-87ea-2759-9242-b13f2602a6d4
provider: Company
product_name: Sample VNF
software_version: '1.0'
descriptor_version: '1.0'
vnfm_info:
- Tacker
requirements:
#- virtual_link_external # mapped in lower-level templates
#- virtual_link_internal # mapped in lower-level templates

View File

@@ -0,0 +1,63 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: VNF type definition
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
node_types:
company.provider.VNF:
derived_from: tosca.nodes.nfv.VNF
properties:
id:
type: string
description: ID of this VNF
default: vnf_id
vendor:
type: string
description: name of the vendor who generate this VNF
default: vendor
version:
type: version
description: version of the software for this VNF
default: 1.0
descriptor_id:
type: string
constraints: [ valid_values: [ 75ebb928-87ea-2759-9242-b13f2602a6d4 ] ]
default: 75ebb928-87ea-2759-9242-b13f2602a6d4
descriptor_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
provider:
type: string
constraints: [ valid_values: [ 'Company' ] ]
default: 'Company'
product_name:
type: string
constraints: [ valid_values: [ 'Sample VNF' ] ]
default: 'Sample VNF'
software_version:
type: string
constraints: [ valid_values: [ '1.0' ] ]
default: '1.0'
vnfm_info:
type: list
entry_schema:
type: string
constraints: [ valid_values: [ Tacker ] ]
default: [ Tacker ]
flavour_id:
type: string
constraints: [ valid_values: [ simple ] ]
default: simple
flavour_description:
type: string
default: "This is the default flavour description"
requirements:
- virtual_link_internal:
capability: tosca.capabilities.nfv.VirtualLinkable
interfaces:
Vnflcm:
type: tosca.interfaces.nfv.Vnflcm

View File

@@ -0,0 +1,827 @@
#!/bin/bash
set -o xtrace
###############################################################################
#
# This script will install and setting for the Kubernetes Cluster on Ubuntu.
# It's confirmed operation on Ubuntu of below.
#
# * OS type : Ubuntu(64 bit)
# * OS version : 20.04 LTS
# * OS architecture : amd64 (x86_64)
# * Disk/Ram size : 15GB/2GB
# * Pre setup user : ubuntu
#
###############################################################################
#==============================================================================
# Usage Definition
#==============================================================================
function usage {
sudo cat <<_EOT_
$(basename ${0}) is script to construct the kubernetes cluster.
Usage:
$(basename ${0}) [-d] [-o] [-m <master ip address>]
[-w <worker ip address>] [-i <master cluster ip address>]
[-a <k8s api cluster cidr] [-p <k8s pod network cidr>]
[-t <token name>] [-s <token hash>] [-k <certificate key>]
Description:
This script is to construct the kubernetes cluster on a virtual machine.
It can install and configure a Master node or each Worker Node
as specify arguments.
Options:
-m Install and setup all master nodes(use "," to separate, the first master ip is main master ip)
-w Install and setup worker node
-i master cluster IP address (e.g. 192.168.120.100)
-a Kubernetes api cluster CIDR (e.g. 10.96.0.0/12)
-p Kubernetes pod network CIDR (e.g. 192.168.0.0/16)
-d Display the execution result in debug mode
-o Output the execution result to the log file
-t The first master's token name
-s The first master's token hash
-k The first masters certificate key
--help, -h Print this
_EOT_
exit 1
}
declare -g INSTALL_MODE=""
declare -g DEBUG_MODE="False"
declare -g OUTPUT_LOGFILE="False"
# master/worker ip
declare -g MASTER_IPADDRS=${MASTER_IPADDRS:-}
declare -a -g MASTER_IPS=${MASTER_IPS:-}
declare -g MASTER_IP=${MASTER_IP:-}
declare -g WORKER_IPADDR=${WORKER_IPADDR:-}
declare -g TOKEN_NAME=${TOKEN_NAME:-}
declare -g TOKEN_HASH=${TOKEN_HASH:-}
declare -g CERT_KEY=${CERT_KEY:-}
declare -g K8S_API_CLUSTER_CIDR=${K8S_API_CLUSTER_CIDR:-10.96.0.0/12}
declare -g K8S_POD_CIDR=${K8S_POD_CIDR:-192.168.0.0/16}
if [ "$OPTIND" = 1 ]; then
while getopts dom:w:i:a:p:t:s:k:h OPT; do
case $OPT in
m)
MASTER_IPADDRS=$OPTARG # 192.168.120.17,192.168.120.18,192.168.120.19
INSTALL_MODE="master" # master
MASTER_IPS=(${MASTER_IPADDRS//,/ })
MASTER_IP=${MASTER_IPS[0]}
;;
w)
WORKER_IPADDR=$OPTARG # 192.168.120.2
INSTALL_MODE="worker" # worker
;;
i)
MASTER_CLUSTER_IP=$OPTARG # master cluster ip: 192.168.120.100
;;
a)
K8S_API_CLUSTER_CIDR=$OPTARG # cluster cidr: 10.96.0.0/12
;;
p)
K8S_POD_CIDR=$OPTARG # pod network cidr: 192.168.0.0/16
;;
d)
DEBUG_MODE="True" # start debug
;;
o)
OUTPUT_LOGFILE="True" # output log file
;;
t)
TOKEN_NAME=$OPTARG # token name
;;
s)
TOKEN_HASH=$OPTARG # token hash
;;
k)
CERT_KEY=$OPTARG # certificate key
;;
h)
echo "h option. display help"
usage
;;
\?)
echo "Try to enter the h option." 1>&2
;;
esac
done
else
echo "No installed getopts-command." 1>&2
exit 1
fi
# check parameter entered by user
if [ "$DEBUG_MODE" == "True" ]; then
echo "*** DEBUG MODE ***"
set -x
fi
if [ "$OUTPUT_LOGFILE" == "True" ]; then
echo "*** OUTPUT LOGFILE MODE ***"
exec > /tmp/k8s_install_`date +%Y%m%d%H%M%S`.log 2>&1
fi
# Application Variables
#----------------------
# haproxy
declare -g CURRENT_HOST_IP=${CURRENT_HOST_IP:-}
declare -g MASTER_CLUSTER_PORT=16443
# kubeadm join
declare -g KUBEADM_JOIN_WORKER_RESULT=${KUBEADM_JOIN_WORKER_RESULT:-}
# Functions
#==========
# Set OS common functions
#------------------------
# Set public DNS
function set_public_dns {
sudo sed -i -e 's/^#DNS=/DNS=8.8.8.8 8.8.4.4/g' /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved.service
}
function set_hostname {
tmp_master_ipaddr3=`echo ${MASTER_IP} | sudo sed -e "s/.[0-9]\{1,3\}$//"`
local tmp_result=""
if [[ "$INSTALL_MODE" =~ "master" ]]; then
for _ip in `ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`; do
_tmp_ip=`echo ${_ip} |sudo sed -e "s/.[0-9]\{1,3\}$//"`
if [[ $_tmp_ip == $tmp_master_ipaddr3 ]]; then
CURRENT_HOST_IP=$_ip
tmp_result=`echo $_ip|cut -d"." -f4`
break
fi
done
sudo /usr/bin/hostnamectl set-hostname master$tmp_result
elif [[ "$INSTALL_MODE" == "worker" ]]; then
CURRENT_HOST_IP=$WORKER_IPADDR
tmp_result=`echo $CURRENT_HOST_IP|cut -d"." -f4`
sudo /usr/bin/hostnamectl set-hostname worker$tmp_result
else
echo "error. please execute sh install_k8s_cluster.sh -h."
exit 0
fi
}
function set_sudoers {
echo "ubuntu ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/ubuntu
}
function set_hosts {
hostname=`hostname`
sudo sed -i -e 's/127.0.0.1localhost/127.0.0.1 localhost master/g' \
/etc/hosts
sudo sed -i -e "s/127.0.1.1 $hostname/127.0.1.1 $hostname master/g" \
/etc/hosts
}
function invalidate_swap {
sudo sed -i -e '/swap/s/^/#/' /etc/fstab
swapoff -a
}
# Install Haproxy
#----------------
function install_haproxy {
REPOS_UPDATED=False apt_get_update
apt_get install haproxy
}
function modify_haproxy_conf {
cat <<EOF | sudo tee /etc/haproxy/haproxy.cfg >/dev/null
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
defaults
log global
mode http
option httplog
option dontlognull
timeout connect 5000
timeout client 50000
timeout server 50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http
frontend kubernetes-apiserver
mode tcp
bind *:$MASTER_CLUSTER_PORT
option tcplog
default_backend kubernetes-apiserver
backend kubernetes-apiserver
mode tcp
balance roundrobin
EOF
for master_ip in ${MASTER_IPS[@]}; do
split_ips=(${master_ip//./ })
cat <<EOF | sudo tee -a /etc/haproxy/haproxy.cfg >/dev/null
server master${split_ips[3]} $master_ip:6443 check
EOF
done
cat <<EOF | sudo tee -a /etc/haproxy/haproxy.cfg >/dev/null
listen stats
bind *:1080
stats auth admin:awesomePassword
stats refresh 5s
stats realm HAProxy\ Statistics
stats uri /admin?stats
EOF
}
function start_haproxy {
sudo systemctl enable haproxy
sudo systemctl start haproxy
sudo systemctl status haproxy | grep Active
result=$(ss -lnt |grep -E "16443|1080")
if [[ -z $result ]]; then
sudo systemctl restart haproxy
fi
}
# Install Keepalived
#-------------------
function install_keepalived {
REPOS_UPDATED=False apt_get_update
apt_get install keepalived
}
function modify_keepalived_conf {
local priority
local ip_name
local index=0
for master_ip in ${MASTER_IPS[@]}; do
if [[ "$CURRENT_HOST_IP" == "$master_ip" ]]; then
priority=$(expr 103 - $index)
fi
index=$(expr $index + 1)
done
ip_name=$(ip a s | grep $CURRENT_HOST_IP | awk '{print $NF}')
cat <<EOF | sudo tee /etc/keepalived/keepalived.conf >/dev/null
vrrp_script chk_haproxy {
script "killall -0 haproxy"
interval 3 fall 3
}
vrrp_instance VRRP1 {
state MASTER
interface $ip_name
virtual_router_id 51
priority $priority
advert_int 1
virtual_ipaddress {
$MASTER_CLUSTER_IP/24
}
track_script {
chk_haproxy
}
}
EOF
}
function start_keepalived {
sudo systemctl enable keepalived.service
sudo systemctl start keepalived.service
sudo systemctl status keepalived.service | grep Active
result=$(sudo systemctl status keepalived.service | \
grep Active | grep "running")
if [[ "$result" == "" ]]; then
exit 0
fi
}
# Install Docker
#---------------
function install_docker {
arch=$(sudo dpkg --print-architecture)
REPOS_UPDATED=False apt_get_update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y \
apt-transport-https ca-certificates curl gnupg-agent \
software-properties-common
result=`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo apt-key add -`
if [[ $result != "OK" ]]; then
exit 0
fi
sudo add-apt-repository \
"deb [arch=${arch}] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt_get update
DEBIAN_FRONTEND=noninteractive sudo apt-get install \
docker-ce \
docker-ce-cli containerd.io << EOF
y
EOF
}
function set_docker_proxy {
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo touch /etc/systemd/system/docker.service.d/https-proxy.conf
cat <<EOF | sudo tee \
/etc/systemd/system/docker.service.d/https-proxy.conf >/dev/null
[Service]
Environment="HTTP_PROXY=${http_proxy//%40/@}" "HTTPS_PROXY=${https_proxy//%40/@}" "NO_PROXY=$no_proxy"
EOF
cat <<EOF | sudo tee /etc/docker/daemon.json >/dev/null
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
sleep 3
result=$(sudo systemctl status docker | grep Active | grep "running")
if [[ -z "$result" ]]; then
exit 0
fi
sleep 7
sudo docker run hello-world
}
# Install Kubernetes
#-------------------
function set_k8s_components {
REPOS_UPDATED=False apt_get_update
sleep 60
sudo apt-get install -y apt-transport-https curl
result=`curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
sudo apt-key add -`
if [[ $result != "OK" ]]; then
exit 0
fi
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | \
sudo tee -a /etc/apt/sources.list.d/kubernetes.list
apt_get update
sleep 60
apt_get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl
echo "starting kubelet, wait 30s ..."
sleep 30
sudo systemctl status kubelet | grep Active
}
function init_master {
if [[ "$MASTER_IPADDRS" =~ "," ]]; then
bindPort=16443
else
bindPort=6443
fi
cat <<EOF | sudo tee "kubeadm.yaml" >/dev/null
apiVersion: kubeadm.k8s.io/v1beta2
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: abcdef.0123456789abcdef
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: $MASTER_CLUSTER_IP
bindPort: $bindPort
nodeRegistration:
criSocket: /var/run/dockershim.sock
name: $hostname
taints:
- effect: NoSchedule
key: node-role.kubernetes.io/master
---
apiServer:
certSANs:
- $MASTER_CLUSTER_IP
timeoutForControlPlane: 8m0s
apiVersion: kubeadm.k8s.io/v1beta2
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controlPlaneEndpoint: $MASTER_CLUSTER_IP:$bindPort
controllerManager: {}
dns:
type: CoreDNS
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: k8s.gcr.io
kind: ClusterConfiguration
networking:
dnsDomain: cluster.local
serviceSubnet: $K8S_API_CLUSTER_CIDR
podSubnet: $K8S_POD_CIDR
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
EOF
sudo kubeadm init --config=kubeadm.yaml --upload-certs
sleep 3
sudo mkdir -p $HOME/.kube
sudo /bin/cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
sleep 20
}
function install_pod_network {
wget https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
echo "waiting install pod network..."
count=3
while ((count > 0)); do
result=$(kubectl apply -f kube-flannel.yml)
if [[ "$result" =~ "created" ]] || \
[[ "$result" =~ "unchanged" ]]; then
echo "$result"
break
fi
sudo rm -rf $HOME/.kube
sudo mkdir -p $HOME/.kube
sudo /bin/cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
sleep 10
((count--))
done
if count == 0; then
echo 'install flannel failed!'
exit 255
fi
}
function install_multus_cni {
git clone https://github.com/intel/multus-cni.git
count=3
while ((count > 0)); do
result=$(cat multus-cni/images/multus-daemonset.yml | kubectl apply -f -)
if [[ "$result" =~ "created" ]] || \
[[ "$result" =~ "unchanged" ]]; then
echo "$result"
break
fi
sleep 10
((count--))
done
if count == 0; then
echo 'install multus failed!'
exit 255
fi
kubectl api-versions | grep -i cncf
}
function prepare_ovs_cni {
cd free5gc-eno/
wget https://raw.githubusercontent.com/k8snetworkplumbingwg/ovs-cni/main/examples/ovs-cni.yml
cd ~
}
function add_master_node {
sudo kubeadm join $MASTER_CLUSTER_IP:16443 \
--token $TOKEN_NAME \
--discovery-token-ca-cert-hash sha256:$TOKEN_HASH \
--control-plane --certificate-key $CERT_KEY
sudo mkdir -p $HOME/.kube
sudo /bin/cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
echo "add node ..."
sleep 10
kubectl get nodes -o wide
echo "add node successfully"
}
function init_worker {
sudo kubeadm init --pod-network-cidr=$K8S_POD_CIDR \
--service-cidr=$K8S_API_CLUSTER_CIDR
sleep 5
sudo mkdir -p $HOME/.kube
sudo /bin/cp -f /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
sleep 10
}
function add_worker_node {
if [[ "$ha_flag" != "False" ]]; then
KUBEADM_JOIN_WORKER_RESULT=$(sudo kubeadm join \
$MASTER_CLUSTER_IP:16443 --token $TOKEN_NAME \
--discovery-token-ca-cert-hash sha256:$TOKEN_HASH)
else
KUBEADM_JOIN_WORKER_RESULT=$(sudo kubeadm join \
$MASTER_CLUSTER_IP:6443 --token $TOKEN_NAME \
--discovery-token-ca-cert-hash sha256:$TOKEN_HASH)
fi
}
function set_br_ex {
ip_br_1=`ip addr | grep '/23' | awk '{print $2}'`
interface_name_1=`ip addr | grep '/23' | awk '{print $8}'`
sudo ip addr del $ip_br_1 dev $interface_name_1
sudo ovs-vsctl add-br br1
sudo ovs-vsctl add-port br1 $interface_name_1
sudo ip addr add $ip_br_1 dev br1
sudo ip link set br1 up
ip_br_2=`ip addr | grep '192.168.20' | awk '{print $2}'`
interface_name_2=`ip addr | grep '192.168.20' | awk '{print $8}'`
sudo ip addr del $ip_br_2 dev $interface_name_2
sudo ovs-vsctl add-br br2
sudo ovs-vsctl add-port br2 $interface_name_2
sudo ip addr add $ip_br_2 dev br2
sudo ip link set br2 up
ip_br_3=`ip addr | grep '192.168.52' | awk '{print $2}'`
interface_name_3=`ip addr | grep '192.168.52' | awk '{print $8}'`
sudo ip addr del $ip_br_3 dev $interface_name_3
sudo ovs-vsctl add-br br3
sudo ovs-vsctl add-port br3 $interface_name_3
sudo ip addr add $ip_br_3 dev br3
sudo ip link set br3 up
sudo iptables -t nat -A POSTROUTING -o $interface_name_2 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE
}
# Set common functions
#
# Refer: devstack project functions-common
#-----------------------------------------
function apt_get_update {
if [[ "$REPOS_UPDATED" == "True" ]]; then
return
fi
local sudo="sudo"
[[ "$(id -u)" = "0" ]] && sudo="env"
# time all the apt operations
time_start "apt-get-update"
local update_cmd="sudo apt-get update"
if ! timeout 300 sh -c "while ! $update_cmd; do sleep 30; done"; then
die $LINENO "Failed to update apt repos, we're dead now"
fi
REPOS_UPDATED=True
# stop the clock
time_stop "apt-get-update"
}
function time_start {
local name=$1
local start_time=${_TIME_START[$name]}
if [[ -n "$start_time" ]]; then
die $LINENO \
"Trying to start the clock on $name, but it's already been started"
fi
_TIME_START[$name]=$(date +%s%3N)
}
function time_stop {
local name
local end_time
local elapsed_time
local total
local start_time
name=$1
start_time=${_TIME_START[$name]}
if [[ -z "$start_time" ]]; then
die $LINENO \
"Trying to stop the clock on $name, but it was never started"
fi
end_time=$(date +%s%3N)
elapsed_time=$(($end_time - $start_time))
total=${_TIME_TOTAL[$name]:-0}
# reset the clock so we can start it in the future
_TIME_START[$name]=""
_TIME_TOTAL[$name]=$(($total + $elapsed_time))
}
function apt_get {
local xtrace result
xtrace=$(set +o | grep xtrace) # set +o xtrace
set +o xtrace
[[ "$OFFLINE" = "True" || -z "$@" ]] && return
local sudo="sudo"
[[ "$(id -u)" = "0" ]] && sudo="env"
# time all the apt operations
time_start "apt-get"
$xtrace
$sudo DEBIAN_FRONTEND=noninteractive \
http_proxy=${http_proxy:-} https_proxy=${https_proxy:-} \
no_proxy=${no_proxy:-} \
apt-get --option "Dpkg::Options::=--force-confold" \
--assume-yes "$@" < /dev/null
result=$?
# stop the clock
time_stop "apt-get"
return $result
}
# Choose install function based on install mode
#----------------------------------------------
function main_master {
# prepare
set_public_dns
set_hostname
set_sudoers
set_hosts
invalidate_swap
if [[ "$MASTER_IPADDRS" =~ "," ]]; then
# haproxy
install_haproxy
modify_haproxy_conf
start_haproxy
# keepalived
install_keepalived
modify_keepalived_conf
start_keepalived
fi
# Docker
install_docker
set_docker_proxy
# kubernetes
set_k8s_components
init_master
install_pod_network
install_multus_cni
prepare_ovs_cni
# build_free5gc_image
clear
token=$(sudo kubeadm token create)
echo "token:$token"
server=$(kubectl cluster-info | \
sed 's,\x1B\[[0-9;]*[a-zA-Z],,g' | \
grep 'Kubernetes' |awk '{print $7}')
echo "server:$server"
cat /etc/kubernetes/pki/ca.crt
ssl_ca_cert_hash=$(openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | \
openssl rsa -pubin -outform der 2>/dev/null | \
openssl dgst -sha256 -hex | sudo sed 's/^.* //')
echo "ssl_ca_cert_hash:$ssl_ca_cert_hash"
cert_key=$(sudo kubeadm init phase upload-certs --upload-certs)
echo "certificate_key:$cert_key"
}
function normal_master {
# prepare
set_public_dns
set_hostname
set_sudoers
set_hosts
invalidate_swap
# haproxy
install_haproxy
modify_haproxy_conf
start_haproxy
# keepalived
install_keepalived
modify_keepalived_conf
start_keepalived
# Docker
install_docker
set_docker_proxy
# kubernetes
set_k8s_components
add_master_node
}
function main_worker {
# prepare
set_public_dns
set_hostname
set_sudoers
set_hosts
invalidate_swap
# Docker
set_docker_proxy
# kubernetes
set_k8s_components
add_worker_node
# set br-ex
set_br_ex
}
# Pre preparations
# ________________
function check_OS {
. /etc/os-release
if [[ $PRETTY_NAME =~ "Ubuntu 20.04" ]]; then
os_architecture=`uname -a | grep 'x86_64'`
if [[ $os_architecture == "" ]]; then
echo "Your OS does not support at present."
echo "It only supports x86_64."
fi
else
echo "Your OS does not support at present."
echo "It only supports Ubuntu 20.04.1 LTS."
fi
}
function set_apt-conf_proxy {
sudo touch /etc/apt/apt.conf.d/proxy.conf
cat <<EOF | sudo tee /etc/apt/apt.conf.d/proxy.conf >/dev/null
Acquire::http::Proxy "${http_proxy}";
Acquire::https::Proxy "${https_proxy}";
EOF
}
# Main
# ____
flag="False"
set_apt-conf_proxy
check_OS
if [[ "$INSTALL_MODE" =~ "master" ]]; then
echo "Start install to main master node"
for _ip in `ip -4 addr | grep -oP '(?<=inet\s)\d+(\.\d+){3}'`; do
if [[ $_ip == $MASTER_IP ]]; then
flag="True"
break
fi
done
if [[ "$flag" == "True" ]]; then
INSTALL_MODE="main_master"
main_master
else
INSTALL_MODE="normal_master"
normal_master
fi
elif [ "$INSTALL_MODE" == "worker" ]; then
echo "Start install to worker node"
main_worker
else
echo "The install mode does not support at present!"
exit 255
fi
if [[ "$INSTALL_MODE" =~ "master" ]]; then
result=$(kubectl get nodes -o wide | grep $CURRENT_HOST_IP)
if [[ -z "$result" ]];then
echo "Install Failed! The node does not exist in Kubernetes cluster."
exit 255
else
echo "Install Success!"
fi
else
if [[ "$KUBEADM_JOIN_WORKER_RESULT" =~ \
"This node has joined the cluster" ]]; then
echo "Install Success!"
else
echo "Install Failed! The node does not exist in Kubernetes cluster."
exit 255
fi
fi
exit 0

View File

@@ -0,0 +1,14 @@
TOSCA-Meta-File-Version: 1.0
Created-by: Dummy User
CSAR-Version: 1.1
Entry-Definitions: Definitions/sample_free5gc_cnf_on_vm_top.vnfd.yaml
Name: Scripts/install_k8s_cluster.sh
Content-Type: application/sh
Algorithm: SHA-256
Hash: <caculate here>
Name: Scripts/kubernetes_mgmt_free5gc.py
Content-Type: text/x-python
Algorithm: SHA-256
Hash: <caculate here>

View File

@@ -0,0 +1,35 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from tacker.vnfm.lcm_user_data.abstract_user_data import AbstractUserData
import tacker.vnfm.lcm_user_data.utils as UserDataUtil
class KubernetesClusterUserData(AbstractUserData):
@staticmethod
def instantiate(base_hot_dict=None,
vnfd_dict=None,
inst_req_info=None,
grant_info=None):
api_param = UserDataUtil.get_diff_base_hot_param_from_api(
base_hot_dict, inst_req_info)
initial_param_dict = \
UserDataUtil.create_initial_param_server_port_dict(
base_hot_dict)
vdu_flavor_dict = \
UserDataUtil.create_vdu_flavor_capability_name_dict(vnfd_dict)
vdu_image_dict = UserDataUtil.create_sw_image_dict(vnfd_dict)
cpd_vl_dict = UserDataUtil.create_network_dict(
inst_req_info, initial_param_dict)
final_param_dict = UserDataUtil.create_final_param_dict(
initial_param_dict, vdu_flavor_dict, vdu_image_dict, cpd_vl_dict)
return {**final_param_dict, **api_param}

View File

@@ -0,0 +1,82 @@
{
"flavourId": "simple",
"vimConnectionInfo": [{
"id": "3cc2c4ff-525c-48b4-94c9-29247223322f",
"vimId": "c3369b54-e376-4423-bb61-afd255900fea",
"vimType": "openstack"
}],
"additionalParams": {
"k8s_cluster_installation_param": {
"script_path": "Scripts/install_k8s_cluster.sh",
"master_node": {
"aspect_id": "master_instance",
"ssh_cp_name": "masterNode_CP1",
"nic_cp_name": "masterNode_CP1",
"username": "ubuntu",
"password": "ubuntu",
"cluster_cp_name": "masterNode_CP1"
},
"worker_node": {
"aspect_id": "worker_instance",
"ssh_cp_name": "workerNode_CP1",
"nic_cp_name": "workerNode_CP1",
"username": "ubuntu",
"password": "ubuntu"
},
"proxy": {
"http_proxy": "http://user:password@host:port",
"https_proxy": "http://user:password@host:port"
}
},
"lcm-operation-user-data": "./UserData/k8s_cluster_user_data.py",
"lcm-operation-user-data-class": "KubernetesClusterUserData"
},
"extVirtualLinks": [
{
"id": "net0_master",
"resourceId": "1642ac54-642c-407c-9c7d-e94c55ba5d33",
"extCps": [{
"cpdId": "masterNode_CP1",
"cpConfig": [{
"linkPortId": "2642ac54-642c-407c-9c7d-e94c55ba5d33"
}]
}]
}, {
"id": "net0_worker",
"resourceId": "1642ac54-642c-407c-9c7d-e94c55ba5d33",
"extCps": [{
"cpdId": "workerNode_CP1",
"cpConfig": [{
"linkPortId": "3642ac54-642c-407c-9c7d-e94c55ba5d33"
}]
}]
}, {
"id": "br1_net_worker",
"resourceId": "bd384a35-c4bb-48f8-8bd0-197c3970d616",
"extCps": [{
"cpdId": "workerNode_CP2",
"cpConfig": [{
"linkPortId": "0129ab10-7ce2-6a1f-adc0-acc6e004f4a9"
}]
}]
}, {
"id": "br2_net_worker",
"resourceId": "506966a9-7fc2-4865-993c-e0e167b65ade",
"extCps": [{
"cpdId": "workerNode_CP3",
"cpConfig": [{
"linkPortId": "3233274b-e78e-98f6-8540-220963784207"
}]
}]
}, {
"id": "br3_net_worker",
"resourceId": "b8d6848b-0d2e-45ec-ae08-357ab3c0a0de",
"extCps": [{
"cpdId": "workerNode_CP4",
"cpConfig": [{
"linkPortId": "9e5f5b25-e397-6983-3fda-eed56a348f49"
}]
}]
}
]
}

View File

@@ -0,0 +1,202 @@
tosca_definitions_version: tosca_simple_yaml_1_2
description: ETSI NFV SOL 001 common types definitions version 2.6.1
metadata:
template_name: etsi_nfv_sol001_common_types
template_author: ETSI_NFV
template_version: 2.6.1
data_types:
tosca.datatypes.nfv.L2AddressData:
derived_from: tosca.datatypes.Root
description: Describes the information on the MAC addresses to be assigned to a connection point.
properties:
mac_address_assignment:
type: boolean
description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
tosca.datatypes.nfv.L3AddressData:
derived_from: tosca.datatypes.Root
description: Provides information about Layer 3 level addressing scheme and parameters applicable to a CP
properties:
ip_address_assignment:
type: boolean
description: Specifies if the address assignment is the responsibility of management and orchestration function or not. If it is set to True, it is the management and orchestration function responsibility
required: true
floating_ip_activated:
type: boolean
description: Specifies if the floating IP scheme is activated on the Connection Point or not
required: true
ip_address_type:
type: string
description: Defines address type. The address type should be aligned with the address type supported by the layer_protocols properties of the parent VnfExtCp
required: false
constraints:
- valid_values: [ ipv4, ipv6 ]
number_of_ip_address:
type: integer
description: Minimum number of IP addresses to be assigned
required: false
constraints:
- greater_than: 0
tosca.datatypes.nfv.AddressData:
derived_from: tosca.datatypes.Root
description: Describes information about the addressing scheme and parameters applicable to a CP
properties:
address_type:
type: string
description: Describes the type of the address to be assigned to a connection point. The content type shall be aligned with the address type supported by the layerProtocol property of the connection point
required: true
constraints:
- valid_values: [ mac_address, ip_address ]
l2_address_data:
type: tosca.datatypes.nfv.L2AddressData
description: Provides the information on the MAC addresses to be assigned to a connection point.
required: false
l3_address_data:
type: tosca.datatypes.nfv.L3AddressData
description: Provides the information on the IP addresses to be assigned to a connection point
required: false
tosca.datatypes.nfv.ConnectivityType:
derived_from: tosca.datatypes.Root
description: describes additional connectivity information of a virtualLink
properties:
layer_protocols:
type: list
description: Identifies the protocol a virtualLink gives access to (ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire).The top layer protocol of the virtualLink protocol stack shall always be provided. The lower layer protocols may be included when there are specific requirements on these layers.
required: true
entry_schema:
type: string
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
flow_pattern:
type: string
description: Identifies the flow pattern of the connectivity
required: false
constraints:
- valid_values: [ line, tree, mesh ]
tosca.datatypes.nfv.LinkBitrateRequirements:
derived_from: tosca.datatypes.Root
description: describes the requirements in terms of bitrate for a virtual link
properties:
root:
type: integer # in bits per second
description: Specifies the throughput requirement in bits per second of the link (e.g. bitrate of E-Line, root bitrate of E-Tree, aggregate capacity of E-LAN).
required: true
constraints:
- greater_or_equal: 0
leaf:
type: integer # in bits per second
description: Specifies the throughput requirement in bits per second of leaf connections to the link when applicable to the connectivity type (e.g. for E-Tree and E LAN branches).
required: false
constraints:
- greater_or_equal: 0
tosca.datatypes.nfv.CpProtocolData:
derived_from: tosca.datatypes.Root
description: Describes and associates the protocol layer that a CP uses together with other protocol and connection point information
properties:
associated_layer_protocol:
type: string
required: true
description: One of the values of the property layer_protocols of the CP
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
address_data:
type: list
description: Provides information on the addresses to be assigned to the CP
entry_schema:
type: tosca.datatypes.nfv.AddressData
required: false
tosca.datatypes.nfv.VnfProfile:
derived_from: tosca.datatypes.Root
description: describes a profile for instantiating VNFs of a particular NS DF according to a specific VNFD and VNF DF.
properties:
instantiation_level:
type: string
description: Identifier of the instantiation level of the VNF DF to be used for instantiation. If not present, the default instantiation level as declared in the VNFD shall be used.
required: false
min_number_of_instances:
type: integer
description: Minimum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
required: true
constraints:
- greater_or_equal: 0
max_number_of_instances:
type: integer
description: Maximum number of instances of the VNF based on this VNFD that is permitted to exist for this VnfProfile.
required: true
constraints:
- greater_or_equal: 0
tosca.datatypes.nfv.Qos:
derived_from: tosca.datatypes.Root
description: describes QoS data for a given VL used in a VNF deployment flavour
properties:
latency:
type: scalar-unit.time #Number
description: Specifies the maximum latency
required: true
constraints:
- greater_than: 0 s
packet_delay_variation:
type: scalar-unit.time #Number
description: Specifies the maximum jitter
required: true
constraints:
- greater_or_equal: 0 s
packet_loss_ratio:
type: float
description: Specifies the maximum packet loss ratio
required: false
constraints:
- in_range: [ 0.0, 1.0 ]
capability_types:
tosca.capabilities.nfv.VirtualLinkable:
derived_from: tosca.capabilities.Node
description: A node type that includes the VirtualLinkable capability indicates that it can be pointed by tosca.relationships.nfv.VirtualLinksTo relationship type
relationship_types:
tosca.relationships.nfv.VirtualLinksTo:
derived_from: tosca.relationships.DependsOn
description: Represents an association relationship between the VduCp and VnfVirtualLink node types
valid_target_types: [ tosca.capabilities.nfv.VirtualLinkable ]
node_types:
tosca.nodes.nfv.Cp:
derived_from: tosca.nodes.Root
description: Provides information regarding the purpose of the connection point
properties:
layer_protocols:
type: list
description: Identifies which protocol the connection point uses for connectivity purposes
required: true
entry_schema:
type: string
constraints:
- valid_values: [ ethernet, mpls, odu2, ipv4, ipv6, pseudo-wire ]
role: #Name in ETSI NFV IFA011 v0.7.3: cpRole
type: string
description: Identifies the role of the port in the context of the traffic flow patterns in the VNF or parent NS
required: false
constraints:
- valid_values: [ root, leaf ]
description:
type: string
description: Provides human-readable information on the purpose of the connection point
required: false
protocol:
type: list
description: Provides information on the addresses to be assigned to the connection point(s) instantiated from this Connection Point Descriptor
required: false
entry_schema:
type: tosca.datatypes.nfv.CpProtocolData
trunk_mode:
type: boolean
description: Provides information about whether the CP instantiated from this Cp is in Trunk mode (802.1Q or other), When operating in "trunk mode", the Cp is capable of carrying traffic for several VLANs. Absence of this property implies that trunkMode is not configured for the Cp i.e. It is equivalent to boolean value "false".
required: false

View File

@@ -0,0 +1,200 @@
description: Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- free5gc_types.yaml
topology_template:
inputs:
descriptor_id:
type: string
descriptor_version:
type: string
flavour_description:
type: string
flavour_id:
type: string
product_name:
type: string
provider:
type: string
software_version:
type: string
vnfm_info:
entry_schema:
type: string
type: list
node_templates:
VDU1:
properties:
description: kubernetes controller resource as VDU
name: network-controller-server-unix
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU2:
properties:
description: kubernetes controller resource as VDU
name: free5gc-mongodb
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU3:
properties:
description: kubernetes controller resource as VDU
name: free5gc-nrf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU4:
properties:
description: kubernetes controller resource as VDU
name: free5gc-udr-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU5:
properties:
description: kubernetes controller resource as VDU
name: free5gc-upf-deployment
vdu_profile:
max_number_of_instances: 2
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU6:
properties:
description: kubernetes controller resource as VDU
name: free5gc-pcf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU7:
properties:
description: kubernetes controller resource as VDU
name: free5gc-ausf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU8:
properties:
description: kubernetes controller resource as VDU
name: free5gc-nssf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU9:
properties:
description: kubernetes controller resource as VDU
name: free5gc-udm-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU10:
properties:
description: kubernetes controller resource as VDU
name: free5gc-amf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU11:
properties:
description: kubernetes controller resource as VDU
name: free5gc-webui-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VDU12:
properties:
description: kubernetes controller resource as VDU
name: free5gc-smf-deployment
vdu_profile:
max_number_of_instances: 1
min_number_of_instances: 1
type: tosca.nodes.nfv.Vdu.Compute
VNF:
type: company.provider.VNF
properties:
flavour_description: A simple flavour
interfaces:
Vnflcm:
instantiate_start:
implementation: mgmt-drivers-free5gc-cnf
instantiate_end:
implementation: mgmt-drivers-free5gc-cnf
scale_end:
implementation: mgmt-drivers-free5gc-cnf
heal_end:
implementation: mgmt-drivers-free5gc-cnf
artifacts:
mgmt-drivers-free5gc-cnf:
description: Management driver for CNF Free5gc
type: tosca.artifacts.Implementation.Python
file: Scripts/free5gc_mgmt_cnf.py
policies:
- scaling_aspects:
properties:
aspects:
upf_aspect:
description: vdu5 scaling aspect
max_scale_level: 2
name: upf_aspect
step_deltas:
- delta_1
type: tosca.policies.nfv.ScalingAspects
- upf_initial_delta:
properties:
initial_delta:
number_of_instances: 1
targets:
- VDU5
type: tosca.policies.nfv.VduInitialDelta
- upf_scaling_aspect_deltas:
properties:
aspect: upf_aspect
deltas:
delta_1:
number_of_instances: 1
targets:
- VDU5
type: tosca.policies.nfv.VduScalingAspectDeltas
- instantiation_levels:
properties:
default_level: instantiation_level_1
levels:
instantiation_level_1:
description: Smallest size
scale_info:
upf_aspect:
scale_level: 0
instantiation_level_2:
description: Largest size
scale_info:
upf_aspect:
scale_level: 2
type: tosca.policies.nfv.InstantiationLevels
- upf_instantiation_levels:
properties:
levels:
instantiation_level_1:
number_of_instances: 1
instantiation_level_2:
number_of_instances: 2
targets:
- VDU5
type: tosca.policies.nfv.VduInstantiationLevels
substitution_mappings:
node_type: company.provider.VNF
properties:
flavour_id: simple
requirements:
virtual_link_external: []
tosca_definitions_version: tosca_simple_yaml_1_2

View File

@@ -0,0 +1,27 @@
description: Sample VNF
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
- free5gc_types.yaml
- free5gc_df_simple.yaml
topology_template:
inputs:
selected_flavour:
description: VNF deployment flavour selected by the consumer. It is provided
in the API
type: string
node_templates:
VNF:
properties:
descriptor_id: a8bb9888-7c63-4293-a95e-2ef102ae1d3a
descriptor_version: '1.0'
flavour_id:
get_input: selected_flavour
product_name: Sample VNF
provider: Company
software_version: '1.0'
vnfm_info:
- Tacker
requirements: null
type: company.provider.VNF
tosca_definitions_version: tosca_simple_yaml_1_2

View File

@@ -0,0 +1,65 @@
description: VNF type definition
imports:
- etsi_nfv_sol001_common_types.yaml
- etsi_nfv_sol001_vnfd_types.yaml
node_types:
company.provider.VNF:
derived_from: tosca.nodes.nfv.VNF
interfaces:
Vnflcm:
type: tosca.interfaces.nfv.Vnflcm
properties:
descriptor_id:
constraints:
- valid_values:
- a8bb9888-7c63-4293-a95e-2ef102ae1d3a
default: a8bb9888-7c63-4293-a95e-2ef102ae1d3a
type: string
descriptor_version:
constraints:
- valid_values:
- '1.0'
default: '1.0'
type: string
flavour_description:
default: ''
type: string
flavour_id:
constraints:
- valid_values:
- simple
default: simple
type: string
product_name:
constraints:
- valid_values:
- Sample VNF
default: Sample VNF
type: string
provider:
constraints:
- valid_values:
- Company
default: Company
type: string
software_version:
constraints:
- valid_values:
- '1.0'
default: '1.0'
type: string
vnfm_info:
default:
- Tacker
entry_schema:
constraints:
- valid_values:
- Tacker
type: string
type: list
requirements:
- virtual_link_external:
capability: tosca.capabilities.nfv.VirtualLinkable
- virtual_link_internal:
capability: tosca.capabilities.nfv.VirtualLinkable
tosca_definitions_version: tosca_simple_yaml_1_2

View File

@@ -0,0 +1,93 @@
apiVersion: v1
kind: Service
metadata:
name: ngap-svc
namespace: default
spec:
ports:
- protocol: SCTP
port: 38412
targetPort: 38412
selector:
app: free5gc-amf
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-amf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-amf
replicas: 1
template:
metadata:
labels:
app: free5gc-amf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/amf "]
volumeMounts:
- name: amfcfg
mountPath: /go/src/free5gc/config/amfcfg.yaml
subPath: amfcfg.yaml
ports:
- containerPort: 38412
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.2/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
- name: init-network-client-ngap
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br2", "-n=eth2", "-i=192.168.20.20/24"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: amfcfg
configMap:
name: free5gc-configmap
items:
- key: amfcfg.yaml
path: amfcfg.yaml

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-ausf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-ausf
replicas: 1
template:
metadata:
labels:
app: free5gc-ausf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/ausf"]
volumeMounts:
- name: ausfcfg
mountPath: /go/src/free5gc/config/ausfcfg.yaml
subPath: ausfcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.4/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: ausfcfg
configMap:
name: free5gc-configmap
items:
- key: ausfcfg.yaml
path: ausfcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,785 @@
apiVersion: v1
data:
free5GC.conf: |
db_uri: mongodb://mongodb-svc/free5GC
#all logging levels
#panic
#fatal
#error
#warn
#info
#debug
#trace
logger:
# network function
AMF:
debugLevel: trace
ReportCaller: false
SMF:
debugLevel: trace
ReportCaller: false
UDR:
debugLevel: trace
ReportCaller: false
UDM:
debugLevel: trace
ReportCaller: false
NRF:
debugLevel: trace
ReportCaller: false
PCF:
debugLevel: trace
ReportCaller: false
AUSF:
debugLevel: trace
ReportCaller: false
N3IWF:
debugLevel: trace
ReportCaller: false
# library
NAS:
debugLevel: trace
ReportCaller: false
FSM:
debugLevel: trace
ReportCaller: false
NGAP:
debugLevel: trace
ReportCaller: false
NamfComm:
debugLevel: trace
ReportCaller: false
NamfEventExposure:
debugLevel: trace
ReportCaller: false
NsmfPDUSession:
debugLevel: trace
ReportCaller: false
NudrDataRepository:
debugLevel: trace
ReportCaller: false
OpenApi:
debugLevel: trace
ReportCaller: false
Aper:
debugLevel: trace
ReportCaller: false
CommonConsumerTest:
debugLevel: trace
ReportCaller: false
# webui
WEBUI:
debugLevel: trace
ReportCaller: false
amfcfg.yaml: |
info:
version: 1.0.0
description: AMF initial local configuration
configuration:
amfName: AMF
ngapIpList:
- 192.168.2.2
- 192.168.20.20
sbi:
scheme: http
registerIPv4: 192.168.2.2
bindingIPv4: 192.168.2.2
port: 29518
serviceNameList:
- namf-comm
- namf-evts
- namf-mt
- namf-loc
- namf-oam
servedGuamiList:
- plmnId:
mcc: 208
mnc: 93
amfId: cafe00
supportTaiList:
- plmnId:
mcc: 208
mnc: 93
tac: 1
plmnSupportList:
- plmnId:
mcc: 208
mnc: 93
snssaiList:
- sst: 1
sd: 010203
- sst: 2
sd: 112233
supportDnnList:
- internet
nrfUri: http://192.168.2.5:8000
security:
integrityOrder:
- NIA2
cipheringOrder:
- NEA0
networkName:
full: free5GC
short: free
t3502: 720
t3512: 3600
non3gppDeregistrationTimer: 3240
# retransmission timer for paging message
t3513:
enable: true # true or false
expireTime: 6s # default is 6 seconds
maxRetryTimes: 4 # the max number of retransmission
# retransmission timer for NAS Deregistration Request message
t3522:
enable: true # true or false
expireTime: 6s # default is 6 seconds
maxRetryTimes: 4 # the max number of retransmission
# retransmission timer for NAS Registration Accept message
t3550:
enable: true # true or false
expireTime: 6s # default is 6 seconds
maxRetryTimes: 4 # the max number of retransmission
# retransmission timer for NAS Authentication Request/Security Mode Command message
t3560:
enable: true # true or false
expireTime: 6s # default is 6 seconds
maxRetryTimes: 4 # the max number of retransmission
# retransmission timer for NAS Notification message
t3565:
enable: true # true or false
expireTime: 6s # default is 6 seconds
maxRetryTimes: 4 # the max number of retransmission
# the kind of log output
# debugLevel: how detailed to output, value: trace, debug, info, warn, error, fatal, panic
# ReportCaller: enable the caller report or not, value: true or false
logger:
AMF:
debugLevel: debug
ReportCaller: false
NAS:
debugLevel: debug
ReportCaller: false
FSM:
debugLevel: debug
ReportCaller: false
NGAP:
debugLevel: debug
ReportCaller: false
Aper:
debugLevel: info
ReportCaller: false
PathUtil:
debugLevel: debug
ReportCaller: false
OpenApi:
debugLevel: debug
ReportCaller: false
smfcfg.yaml: |
info:
version: 1.0.0
description: SMF initial local configuration
configuration:
smfName: SMF
sbi:
scheme: http
registerIPv4: 192.168.2.3
bindingIPv4: 192.168.2.3
port: 29502
tls:
key: free5gc/support/TLS/smf.key
pem: free5gc/support/TLS/smf.pem
serviceNameList:
- nsmf-pdusession
- nsmf-event-exposure
- nsmf-oam
snssaiInfos: # the S-NSSAI (Single Network Slice Selection Assistance Information) list supported by this AMF
- sNssai: # S-NSSAI (Single Network Slice Selection Assistance Information)
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 010203 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
dnnInfos: # DNN information list
- dnn: internet # Data Network Name
dns: # the IP address of DNS
ipv4: 8.8.8.8
ipv6: 2001:4860:4860::8888
ueSubnet: 60.60.0.0/24 # should be CIDR type
- sNssai: # S-NSSAI (Single Network Slice Selection Assistance Information)
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 112233 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
dnnInfos: # DNN information list
- dnn: internet # Data Network Name
dns: # the IP address of DNS
ipv4: 8.8.8.8
ipv6: 2001:4860:4860::8888
ueSubnet: 60.60.10.0/24 # should be CIDR type
pfcp:
addr: 192.168.2.3
userplane_information: # list of userplane information
up_nodes: # information of userplane node (AN or UPF)
gNB1: # the name of the node
type: AN # the type of the node (AN or UPF)
UPF: # the name of the node
type: UPF # the type of the node (AN or UPF)
node_id: 192.168.2.13 # the IP/FQDN of N4 interface on this UPF (PFCP)
sNssaiUpfInfos: # S-NSSAI information list for this UPF
- sNssai: # S-NSSAI (Single Network Slice Selection Assistance Information)
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 010203 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
dnnUpfInfoList: # DNN information list for this S-NSSAI
- dnn: internet
interfaces: # Interface list for this UPF
- interfaceType: N3 # the type of the interface (N3 or N9)
endpoints: # the IP address of this N3/N9 interface on this UPF
- 192.168.20.14
networkInstance: internet # Data Network Name (DNN)
UPF2: # the name of the node
type: UPF # the type of the node (AN or UPF)
node_id: 192.168.2.15 # the IP/FQDN of N4 interface on this UPF (PFCP)
sNssaiUpfInfos: # S-NSSAI information list for this UPF
- sNssai: # S-NSSAI (Single Network Slice Selection Assistance Information)
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 112233 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
dnnUpfInfoList: # DNN information list for this S-NSSAI
- dnn: internet
interfaces: # Interface list for this UPF
- interfaceType: N3 # the type of the interface (N3 or N9)
endpoints: # the IP address of this N3/N9 interface on this UPF
- 192.168.20.15
networkInstance: internet # Data Network Name (DNN)
links: # the topology graph of userplane, A and B represent the two nodes of each link
- A: gNB1
B: UPF
- A: gNB1
B: UPF2
nrfUri: http://192.168.2.5:8000
ausfcfg.yaml: |
info:
version: 1.0.0
description: AUSF initial local configuration
configuration:
sbi:
scheme: http
registerIPv4: 192.168.2.4
bindingIPv4: 192.168.2.4
port: 29509
serviceNameList:
- nausf-auth
nrfUri: http://192.168.2.5:8000
plmnSupportList:
- mcc: 208
mnc: 93
groupId: ausfGroup001
logger:
AUSF:
debugLevel: trace
ReportCaller: false
PathUtil:
debugLevel: trace
ReportCaller: false
OpenApi:
debugLevel: trace
ReportCaller: false
nrfcfg.yaml: |
info:
version: 1.0.0
description: NRF initial local configuration
configuration:
MongoDBName: "free5gc"
MongoDBUrl: "mongodb://mongodb-svc:27017"
DefaultServiceIP: "192.168.2.5"
sbi: # Service-based interface information
scheme: http # the protocol for sbi (http or https)
registerIPv4: 192.168.2.5 # IP used to serve NFs or register to another NRF
bindingIPv4: 192.168.2.5 # IP used to bind the service
port: 8000 # port used to bind the service
DefaultPlmnId:
mcc: "208"
mnc: "93"
serviceNameList:
- nnrf-nfm
- nnrf-disc
logger:
NRF:
debugLevel: info
ReportCaller: false
PathUtil:
debugLevel: info
ReportCaller: false
OpenApi:
debugLevel: info
ReportCaller: false
MongoDBLibrary:
debugLevel: info
ReportCaller: false
nssfcfg.yaml: |
info:
version: 1.0.0
description: NSSF initial local configuration
configuration:
nssfName: NSSF # the name of this NSSF
sbi: # Service-based interface information
scheme: http # the protocol for sbi (http or https)
registerIPv4: 192.168.2.6 # IP used to register to NRF
bindingIPv4: 192.168.2.6 # IP used to bind the service
port: 8000 # Port used to bind the service
serviceNameList: # the SBI services provided by this SMF, refer to TS 29.531
- nnssf-nsselection # Nnssf_NSSelection service
- nnssf-nssaiavailability # Nnssf_NSSAIAvailability service
nrfUri: http://192.168.2.5:8000 # a valid URI of NRF
supportedPlmnList: # the PLMNs (Public land mobile network) list supported by this NSSF
- mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
supportedNssaiInPlmnList: # Supported S-NSSAI List for each PLMN
- plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 208 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 93 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
supportedSnssaiList: # Supported S-NSSAIs of the PLMN
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 010203 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 112233 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiList: # List of available Network Slice Instance (NSI)
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 10
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 11
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 12
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 12
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 13
- snssai: # S-NSSAI of this NSI
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 20
- snssai: # S-NSSAI of this NSI
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 21
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 010203 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 22
- snssai: # S-NSSAI of this NSI
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 112233 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
nsiInformationList: # Information list of this NSI
# the NRF to be used to select the NFs/services within the selected NSI, and an optonal ID
- nrfId: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
nsiId: 23
amfSetList: # List of AMF Sets that my be assigned by this NSSF
- amfSetId: 1 # the AMF Set identifier
amfList: # Instance ID of the AMFs in this set
- ffa2e8d7-3275-49c7-8631-6af1df1d9d26
- 0e8831c3-6286-4689-ab27-1e2161e15cb1
- a1fba9ba-2e39-4e22-9c74-f749da571d0d
# URI of the NRF used to determine the list of candidate AMF(s) from the AMF Set
nrfAmfSet: http://192.168.2.5:8000/nnrf-nfm/v1/nf-instances
# the Nssai availability data information per TA supported by the AMF
supportedNssaiAvailabilityData:
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33456 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33457 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- amfSetId: 2 # the AMF Set identifier
# URI of the NRF used to determine the list of candidate AMF(s) from the AMF Set
nrfAmfSet: http://localhost:8084/nnrf-nfm/v1/nf-instances
# the Nssai availability data information per TA supported by the AMF
supportedNssaiAvailabilityData:
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33456 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33458 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
amfList: # List of AMFs that may be assigned by this NSSF
- nfId: 469de254-2fe5-4ca0-8381-af3f500af77c # ID of this AMF
# The NSSAI availability data information per TA supported by the AMF
supportedNssaiAvailabilityData:
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33456 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33457 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- nfId: fbe604a8-27b2-417e-bd7c-8a7be2691f8d # ID of this AMF
# The NSSAI availability data information per TA supported by the AMF
supportedNssaiAvailabilityData:
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33458 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33459 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- nfId: b9e6e2cb-5ce8-4cb6-9173-a266dd9a2f0c # ID of this AMF
# The NSSAI availability data information per TA supported by the AMF
supportedNssaiAvailabilityData:
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33456 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33458 # Tracking Area Code (uinteger, range: 0~16777215)
supportedSnssaiList: # Supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
taList: # List of supported tracking area and their related information of this NSSF instance
- tai: # Tracking Area Identity
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33456 # Tracking Area Code (uinteger, range: 0~16777215)
accessType: 3GPP_ACCESS # Access type of the tracking area
supportedSnssaiList: # List of supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- tai: # Tracking Area Identity
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33457 # Tracking Area Code (uinteger, range: 0~16777215)
accessType: 3GPP_ACCESS # Access type of the tracking area
supportedSnssaiList: # List of supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33458 # Tracking Area Code (uinteger, range: 0~16777215)
accessType: 3GPP_ACCESS # Access type of the tracking area
supportedSnssaiList: # List of supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
restrictedSnssaiList: # List of restricted S-NSSAIs of the tracking area
- homePlmnId: # Home PLMN identifier
mcc: 310 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 560 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
sNssaiList: # the S-NSSAIs List
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- tai: # Tracking Area Identifier
plmnId: # Public Land Mobile Network ID, <PLMN ID> = <MCC><MNC>
mcc: 466 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 92 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
tac: 33459 # Tracking Area Code (uinteger, range: 0~16777215)
accessType: 3GPP_ACCESS # Access type of the tracking area
supportedSnssaiList: # List of supported S-NSSAIs of the tracking area
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
- sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
restrictedSnssaiList: # List of restricted S-NSSAIs of the tracking area
- homePlmnId: # Home PLMN identifier
mcc: 310 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 560 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
sNssaiList: # the S-NSSAIs List
- sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
# List of mappings of S-NSSAI in the serving network and the value of the home network
mappingListFromPlmn:
- operatorName: NTT Docomo # Home PLMN name
homePlmnId: # Home PLMN identifier
mcc: 440 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 10 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
mappingOfSnssai: # List of S-NSSAIs mapping
- servingSnssai: # S-NSSAI in the serving network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 1 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- servingSnssai: # S-NSSAI in the serving network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- servingSnssai: # S-NSSAI in the serving network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000004 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- servingSnssai: # S-NSSAI in the serving network
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 2 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- operatorName: AT&T Mobility # Home PLMN name
homePlmnId: # Home PLMN identifier
mcc: 310 # Mobile Country Code (3 digits string, digit: 0~9)
mnc: 560 # Mobile Network Code (2 or 3 digits string, digit: 0~9)
mappingOfSnssai:
- servingSnssai: # S-NSSAI in the serving network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000001 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
- servingSnssai: # S-NSSAI in the serving network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000002 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
homeSnssai: # S-NSSAI in the home network
sst: 1 # Slice/Service Type (uinteger, range: 0~255)
sd: 000003 # Slice Differentiator (3 bytes hex string, range: 000000~FFFFFF)
# the kind of log output
# debugLevel: how detailed to output, value: trace, debug, info, warn, error, fatal, panic
# ReportCaller: enable the caller report or not, value: true or false
logger:
NSSF:
debugLevel: info
ReportCaller: false
PathUtil:
debugLevel: info
ReportCaller: false
OpenApi:
debugLevel: info
ReportCaller: false
pcfcfg.yaml: |
info:
version: 1.0.0
description: PCF initial local configuration
configuration:
pcfName: PCF # the name of this PCF
sbi: # Service-based interface information
scheme: http # the protocol for sbi (http or https)
registerIPv4: 192.168.2.9 # IP used to register to NRF
bindingIPv4: 192.168.2.9 # IP used to bind the service
port: 8000 # port used to bind the service
timeFormat: 2019-01-02 15:04:05 # time format of this PCF
defaultBdtRefId: BdtPolicyId- # BDT Reference ID, indicating transfer policies of background data transfer.
nrfUri: http://192.168.2.5:8000 # a valid URI of NRF
serviceList: # the SBI services provided by this PCF, refer to TS 29.507
- serviceName: npcf-am-policy-control # Npcf_AMPolicyControl service
- serviceName: npcf-smpolicycontrol # Npcf_SMPolicyControl service
suppFeat: 3fff # the features supported by Npcf_SMPolicyControl, name defined in TS 29.512 5.8-1, value defined in TS 29.571 5.2.2
- serviceName: npcf-bdtpolicycontrol # Npcf_BDTPolicyControl service
- serviceName: npcf-policyauthorization # Npcf_PolicyAuthorization service
suppFeat: 3 # the features supported by Npcf_PolicyAuthorization, name defined in TS 29.514 5.8-1, value defined in TS 29.571 5.2.2
- serviceName: npcf-eventexposure # Npcf_EventExposure service
- serviceName: npcf-ue-policy-control # Npcf_UEPolicyControl service
mongodb: # the mongodb connected by this PCF
name: free5gc # name of the mongodb
url: mongodb://mongodb-svc:27017 # a valid URL of the mongodb
# the kind of log output
# debugLevel: how detailed to output, value: trace, debug, info, warn, error, fatal, panic
# ReportCaller: enable the caller report or not, value: true or false
logger:
PCF:
debugLevel: info
ReportCaller: false
PathUtil:
debugLevel: info
ReportCaller: false
OpenApi:
debugLevel: info
ReportCaller: false
udmcfg.yaml: |
info:
version: 1.0.0
description: UDM initial local configuration
configuration:
serviceNameList: # the SBI services provided by this UDM, refer to TS 29.503
- nudm-sdm # Nudm_SubscriberDataManagement service
- nudm-uecm # Nudm_UEContextManagement service
- nudm-ueau # Nudm_UEAuthenticationManagement service
- nudm-ee # Nudm_EventExposureManagement service
- nudm-pp # Nudm_ParameterProvisionDataManagement service
sbi: # Service-based interface information
scheme: http # the protocol for sbi (http or https)
registerIPv4: 192.168.2.7 # IP used to register to NRF
bindingIPv4: 192.168.2.7 # IP used to bind the service
port: 8000 # Port used to bind the service
tls: # the local path of TLS key
log: free5gc/udmsslkey.log # UDM keylog
pem: free5gc/support/TLS/udm.pem # UDM TLS Certificate
key: free5gc/support/TLS/udm.key # UDM TLS Private key
nrfUri: http://192.168.2.5:8000 # a valid URI of NRF
# test data set from TS33501-f60 Annex C.4
keys:
udmProfileAHNPublicKey: 5a8d38864820197c3394b92613b20b91633cbd897119273bf8e4a6f4eec0a650
udmProfileAHNPrivateKey: c53c22208b61860b06c62e5406a7b330c2b577aa5558981510d128247d38bd1d
udmProfileBHNPublicKey: 0472DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD15A7DED52FCBB097A4ED250E036C7B9C8C7004C4EEDC4F068CD7BF8D3F900E3B4
udmProfileBHNPrivateKey: F1AB1074477EBCC7F554EA1C5FC368B1616730155E0041AC447D6301975FECDA
# the kind of log output
# debugLevel: how detailed to output, value: trace, debug, info, warn, error, fatal, panic
# ReportCaller: enable the caller report or not, value: true or false
logger:
UDM:
debugLevel: trace
ReportCaller: false
OpenApi:
debugLevel: trace
ReportCaller: false
PathUtil:
debugLevel: trace
ReportCaller: false
udrcfg.yaml: |
info:
version: 1.0.0
description: UDR initial local configuration
configuration:
sbi:
scheme: http
registerIPv4: 192.168.2.8
bindingIPv4: 192.168.2.8
port: 29504
mongodb:
name: free5gc
url: mongodb://mongodb-svc:27017
nrfUri: http://192.168.2.5:8000
webuicfg.yaml: |
info:
version: 1.0.0
description: WebUI initial local configuration
configuration:
mongodb:
name: free5gc
url: mongodb://mongodb-svc:27017
kind: ConfigMap
metadata:
name: free5gc-configmap
namespace: default

View File

@@ -0,0 +1,64 @@
apiVersion: v1
kind: Service
metadata:
name: mongodb-svc
namespace: default
spec:
ports:
- port: 27017
selector:
app: free5gc-mongodb
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-mongodb
namespace: default
spec:
selector:
matchLabels:
app: free5gc-mongodb
template:
metadata:
labels:
app: free5gc-mongodb
spec:
containers:
- image: free5gmano/free5gc-mongodb
name: free5gc-mongodb
ports:
- containerPort: 27017
name: mongodb
volumeMounts:
- name: mongodb-persistent-storage
mountPath: /data/db
volumes:
- name: mongodb-persistent-storage
persistentVolumeClaim:
claimName: mongodb-pv-claim
---
kind: PersistentVolume
apiVersion: v1
metadata:
name: mongodb-pv-volume
labels:
type: local
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/free5gmongodb"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongodb-pv-claim
namespace: default
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-nrf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-nrf
replicas: 1
template:
metadata:
labels:
app: free5gc-nrf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/nrf"]
volumeMounts:
- name: nrfcfg
mountPath: /go/src/free5gc/config/nrfcfg.yaml
subPath: nrfcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.5/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: nrfcfg
configMap:
name: free5gc-configmap
items:
- key: nrfcfg.yaml
path: nrfcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-nssf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-nssf
replicas: 1
template:
metadata:
labels:
app: free5gc-nssf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/nssf"]
volumeMounts:
- name: nssfcfg
mountPath: /go/src/free5gc/config/nssfcfg.yaml
subPath: nssfcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.6/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: nssfcfg
configMap:
name: free5gc-configmap
items:
- key: nssfcfg.yaml
path: nssfcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-pcf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-pcf
replicas: 1
template:
metadata:
labels:
app: free5gc-pcf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/pcf"]
volumeMounts:
- name: pcfcfg
mountPath: /go/src/free5gc/config/pcfcfg.yaml
subPath: pcfcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.9/23", "-g=192.168.3.254", "--route-gw=192.168.20.0/24,192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: pcfcfg
configMap:
name: free5gc-configmap
items:
- key: pcfcfg.yaml
path: pcfcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,66 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-smf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-smf
replicas: 1
template:
metadata:
labels:
app: free5gc-smf
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/smf"]
volumeMounts:
- name: smfcfg
mountPath: /go/src/free5gc/config/smfcfg.yaml
subPath: smfcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.3/23", "-g=192.168.3.254", "--route-gw=192.168.20.0/24,192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: smfcfg
configMap:
name: free5gc-configmap
items:
- key: smfcfg.yaml
path: smfcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-udm-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-udm
replicas: 1
template:
metadata:
labels:
app: free5gc-udm
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/udm"]
volumeMounts:
- name: udmcfg
mountPath: /go/src/free5gc/config/udmcfg.yaml
subPath: udmcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.7/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: udmcfg
configMap:
name: free5gc-configmap
items:
- key: udmcfg.yaml
path: udmcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-udr-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-udr
replicas: 1
template:
metadata:
labels:
app: free5gc-udr
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./bin/udr"]
volumeMounts:
- name: udrcfg
mountPath: /go/src/free5gc/config/udrcfg.yaml
subPath: udrcfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.8/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: udrcfg
configMap:
name: free5gc-configmap
items:
- key: udrcfg.yaml
path: udrcfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,105 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-upf-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-upf
replicas: 1
template:
metadata:
labels:
app: free5gc-upf
spec:
containers:
- name: myapp-container
image: eno/free5gc
securityContext:
privileged: true
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "ip addr add 60.60.0.100 dev lo && ip link set dev lo up && ./NFs/upf/build/bin/free5gc-upfd -f /go/src/free5gc/NFs/upf/build/config/upfcfg.yaml"]
volumeMounts:
- mountPath: /dev/net/tun
name: tun-volume
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
ports:
- containerPort: 2152
initContainers:
- name: init-network-client-dn
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br3", "-n=eth3", "-i=192.168.52.254/24"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
- name: init-network-client-gtp
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br2", "-n=eth1", "-i=192.168.20.14/24", "-g=192.168.20.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth2", "-i=192.168.2.13/23", "-g=192.168.2.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: tun-volume
hostPath:
path: /dev/net/tun
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,84 @@
apiVersion: v1
kind: Service
metadata:
name: webui-svc
namespace: default
spec:
ports:
- name: http
protocol: TCP
port: 5000
targetPort: 5000
nodePort: 30050
selector:
app: free5gc-webui
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: free5gc-webui-deployment
namespace: default
spec:
selector:
matchLabels:
app: free5gc-webui
replicas: 1
template:
metadata:
labels:
app: free5gc-webui
spec:
containers:
- name: myapp-container
image: eno/free5gc
imagePullPolicy: Never
command: ["/bin/sh"]
args: ["-c", "./webconsole/bin/webconsole"]
volumeMounts:
- name: webuicfg
mountPath: /go/src/free5gc/config/webuicfg.yaml
subPath: webuicfg.yaml
- name: free5gc
mountPath: /go/src/free5gc/config/free5GC.conf
subPath: free5GC.conf
ports:
- containerPort: 5000
initContainers:
- name: init-network-client
image: sdnvortex/network-controller:v0.4.9
command: ["/go/bin/client"]
args: ["-s=unix:///tmp/vortex.sock", "-b=br1", "-n=eth1", "-i=192.168.2.11/23", "-g=192.168.3.254"]
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: POD_UUID
valueFrom:
fieldRef:
fieldPath: metadata.uid
volumeMounts:
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: grpc-sock
hostPath:
path: /tmp/vortex/
- name: webuicfg
configMap:
name: free5gc-configmap
items:
- key: webuicfg.yaml
path: webuicfg.yaml
- name: free5gc
configMap:
name: free5gc-configmap
items:
- key: free5GC.conf
path: free5GC.conf

View File

@@ -0,0 +1,48 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: network-controller-server-unix
namespace: kube-system
spec:
selector:
matchLabels:
name: network-controller-server-unix
template:
metadata:
labels:
name: network-controller-server-unix
spec:
tolerations:
- key: node-role.kubernetes.io/master
effect: NoSchedule
containers:
- name: network-controller-server-unix
image: sdnvortex/network-controller:v0.4.9
securityContext:
privileged: true
command: ["/go/bin/server"]
args: ["-unix=/tmp/vortex.sock", "-netlink-gc"]
volumeMounts:
- mountPath: /var/run/docker/netns:shared
name: docker-ns
#mountPropagation: Bidirectional
- mountPath: /var/run/docker.sock
name: docker-sock
- mountPath: /var/run/openvswitch/db.sock
name: ovs-sock
- mountPath: /tmp/
name: grpc-sock
volumes:
- name: docker-ns
hostPath:
path: /run/docker/netns
- name: docker-sock
hostPath:
path: /run/docker.sock
- name: ovs-sock
hostPath:
path: /run/openvswitch/db.sock
- name: grpc-sock
hostPath:
path: /tmp/vortex
hostNetwork: true

View File

@@ -0,0 +1,785 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import time
import eventlet
from oslo_log import log as logging
import paramiko
import yaml
from tacker.common import cmd_executer
from tacker.common import exceptions
from tacker.common import log
from tacker.vnflcm import utils as vnflcm_utils
from tacker.vnfm.mgmt_drivers import vnflcm_abstract_driver
LOG = logging.getLogger(__name__)
FREE5GC_CMD_TIMEOUT = 30
class Free5gcMgmtDriverCnf(vnflcm_abstract_driver.VnflcmMgmtAbstractDriver):
def get_type(self):
return 'mgmt-drivers-free5gc-cnf'
def get_name(self):
return 'mgmt-drivers-free5gc-cnf'
def get_description(self):
return 'Tacker VNFMgmt Free5gc CNF Driver'
@log.log
def instantiate_start(self, context, vnf_instance,
instantiate_vnf_request, grant,
grant_request, **kwargs):
vnf_package_path = vnflcm_utils._get_vnf_package_path(
context, vnf_instance.vnfd_id)
kubernetes_file_paths = instantiate_vnf_request.\
additional_params.get('lcm-kubernetes-def-files')
for path in kubernetes_file_paths:
if 'configmap' in path:
configmap_path = os.path.join(vnf_package_path, path)
if 'amf' in path:
amf_path = os.path.join(vnf_package_path, path)
if 'smf' in path:
smf_path = os.path.join(vnf_package_path, path)
if 'upf' in path:
upf_path = os.path.join(vnf_package_path, path)
with open(amf_path) as f:
results = yaml.safe_load_all(f)
for result in results:
if result.get('kind') == 'Deployment':
amf_init_containers = result.get('spec').get(
'template').get('spec').get('initContainers')
amf_ip_list = []
for amf_init_container in amf_init_containers:
amf_ip_args = amf_init_container.get('args')
for amf_ip_arg in amf_ip_args:
if '-i=' in amf_ip_arg:
amf_ip = amf_ip_arg.replace('-i=', '')
amf_ip = amf_ip.partition('/')[0]
amf_ip_list.append(amf_ip)
with open(smf_path) as f:
results = yaml.safe_load_all(f)
for result in results:
if result.get('kind') == 'Deployment':
smf_init_containers = result.get('spec').get(
'template').get('spec').get('initContainers')
smf_ip_list = []
for smf_init_container in smf_init_containers:
smf_ip_args = smf_init_container.get('args')
for smf_ip_arg in smf_ip_args:
if '-i=' in smf_ip_arg:
smf_ip = smf_ip_arg.replace('-i=', '')
smf_ip = smf_ip.partition('/')[0]
smf_ip_list.append(smf_ip)
with open(upf_path) as f:
results = yaml.safe_load_all(f)
for result in results:
if result.get('kind') == 'Deployment':
upf_init_containers = result.get('spec').get(
'template').get('spec').get('initContainers')
upf_ip_list = []
for upf_init_container in upf_init_containers:
upf_ip_args = upf_init_container.get('args')
for upf_ip_arg in upf_ip_args:
if '-i=' in upf_ip_arg:
upf_ip = upf_ip_arg.replace('-i=', '')
upf_ip = upf_ip.partition('/')[0]
upf_ip_list.append(upf_ip)
with open(configmap_path, encoding='utf-8') as f:
results = yaml.safe_load_all(f)
for result in results:
# check amfcfg.yaml in configmap
amf_file = result.get('data').get('amfcfg.yaml')
index_start = \
amf_file.index('ngapIpList') + len('ngapIpList') + 1
index_end = amf_file.index('sbi')
amf_ip_str = amf_file[index_start:index_end]
count = 0
for amf_ip in amf_ip_list:
if amf_ip in amf_ip_str:
count = count + 1
if count == 0:
LOG.error('The configmap of amfcfg.yaml is invalid.'
' "ngapIpList" may be wrong.')
raise exceptions.MgmtDriverOtherError(
'The configmap of amfcfg.yaml is invalid.'
' "ngapIpList" may be wrong.')
# check smfcfg.yaml in configmap
smf_file = result.get('data').get('smfcfg.yaml')
index_start = smf_file.index('pfcp') + len('pfcp') + 1
index_end = smf_file.index('userplane_information')
smf_ip_str = smf_file[index_start:index_end]
for smf_pfcp in smf_ip_list:
if smf_pfcp in smf_ip_str:
break
else:
LOG.error('The configmap of smfcfg.yaml is invalid.'
' "pfcp" may be wrong.')
raise exceptions.MgmtDriverOtherError(
'The configmap of smfcfg.yaml is invalid.'
' "pfcp" may be wrong.')
index_start2 = smf_file.index('UPF:') + len('UPF:') + 1
index_end2 = smf_file.index('sNssaiUpfInfos')
upf_pfcp_ip_str = smf_file[index_start2:index_end2]
for upf_ip in upf_ip_list:
if upf_ip in upf_pfcp_ip_str:
break
else:
LOG.error('The configmap of smfcfg.yaml is invalid.'
' The node_id of UPF may be wrong.')
raise exceptions.MgmtDriverOtherError(
'The configmap of smfcfg.yaml is invalid.'
' The node_id of UPF may be wrong.')
def _execute_command(self, commander, ssh_command, timeout, type, retry):
eventlet.monkey_patch()
while retry >= 0:
try:
with eventlet.Timeout(timeout, True):
result = commander.execute_command(
ssh_command, input_data=None)
break
except eventlet.timeout.Timeout:
LOG.debug('It is time out, When execute command: '
'{}.'.format(ssh_command))
retry -= 1
if retry < 0:
LOG.error('It is time out, When execute command: '
'{}.'.format(ssh_command))
raise exceptions.MgmtDriverOtherError(
error_message='It is time out, When execute command: '
'{}.'.format(ssh_command))
time.sleep(30)
if type == 'common':
err = result.get_stderr()
if err:
LOG.error(err)
raise exceptions.MgmtDriverRemoteCommandError(err_info=err)
return result.get_stdout()
def _check_values(self, additional_param):
if not additional_param.get('master_node_username'):
LOG.error('The master_node_username in the '
'additionalParams cannot be None.')
raise exceptions.MgmtDriverNotFound(
param='master_node_username')
if not additional_param.get('master_node_password'):
LOG.error('The master_node_password in the '
'additionalParams cannot be None.')
raise exceptions.MgmtDriverNotFound(
param='master_node_username')
if not additional_param.get('ssh_master_node_ip'):
LOG.error('The ssh_master_node_ip in the '
'additionalParams cannot be None.')
raise exceptions.MgmtDriverNotFound(
param='ssh_master_node_ip')
def _send_and_receive_file(self, host, user, password,
remote_file, local_file, operation):
connect = paramiko.Transport(host, 22)
connect.connect(username=user, password=password)
sftp = paramiko.SFTPClient.from_transport(connect)
if operation == 'receive':
sftp.get(remote_file, local_file)
else:
sftp.put(local_file, remote_file)
connect.close()
@log.log
def instantiate_end(self, context, vnf_instance,
instantiate_vnf_request, grant,
grant_request, **kwargs):
additional_param = instantiate_vnf_request.\
additional_params.get('free5gc', {})
self._check_values(additional_param)
ssh_master_node_ip = additional_param.get('ssh_master_node_ip')
master_node_username = additional_param.get('master_node_username')
master_node_password = additional_param.get('master_node_password')
if not additional_param.get('upf_config_file_path'):
upf_config_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
if not additional_param.get('smf_config_file_path'):
smf_config_file_path = '/go/src/free5gc/config/smfcfg.yaml'
commander = cmd_executer.RemoteCommandExecutor(
user=master_node_username, password=master_node_password,
host=ssh_master_node_ip,
timeout=30)
# get upf ip from smf
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = ("kubectl cp {smf_pod_name}:{smf_config_file_path}"
" /tmp/smfcfg.yaml"
.format(smf_pod_name=smf_pod_name,
smf_config_file_path=smf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_smf_path = '/tmp/smfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/smfcfg.yaml', local_smf_path, 'receive')
upf_gtpu_list = []
with open(local_smf_path) as f:
file_content = yaml.safe_load(f)
upf_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF']['node_id']
upf_gtpu_interface_list = file_content['configuration'][
'userplane_information']['up_nodes']['UPF']['interfaces']
for upf_gtpu_interface in upf_gtpu_interface_list:
upf_gtpu_list = (upf_gtpu_interface['endpoints'] +
upf_gtpu_list)
# modify upf info
upf_example_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
ssh_command = "kubectl get pod | grep upf | awk '{print $1}'"
upf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = ("kubectl cp {upf_pod_name}:{upf_example_file_path}"
" /tmp/upfcfg.yaml -c myapp-container"
.format(upf_pod_name=upf_pod_name,
upf_example_file_path=upf_example_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_upf_path = '/tmp/upfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'receive')
with open(local_upf_path, 'r') as f:
upf_content = yaml.safe_load(f)
upf_content['configuration']['pfcp'][0]['addr'] = upf_pfcp_ip
for index in range(len(upf_gtpu_list)):
upf_content['configuration']['gtpu'][index]['addr'] =\
upf_gtpu_list[index]
with open(local_upf_path, 'w') as nf:
yaml.safe_dump(upf_content, nf, default_flow_style=False)
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'send')
ssh_command = ("kubectl cp /tmp/upfcfg.yaml"
" {upf_pod_name}:{upf_config_file_path}"
" -c myapp-container"
.format(upf_pod_name=upf_pod_name,
upf_config_file_path=upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# start upf process
ssh_command = ('cat <<EOF | sudo tee "run_upf.sh" >/dev/null\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'ip link delete upfgtp\neof\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'./NFs/upf/build/bin/free5gc-upfd -f {}\neof'
'\nEOF\n'
.format(upf_pod_name, upf_pod_name,
upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "sudo chmod 777 run_upf.sh"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "nohup ./run_upf.sh > upf.txt 2>&1 &"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# restart smf
ssh_command = "kubectl get pod {} -o yaml | " \
"kubectl replace --force -f -".format(smf_pod_name)
self._execute_command(
commander, ssh_command, 120,
'common', 0)
time.sleep(120)
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = "kubectl get pod {} | " \
"grep 'Running'".format(smf_pod_name)
result = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 0)
if not result:
LOG.error('SMF restart failed. Please check'
' you k8s-cluster environment.')
raise exceptions.MgmtDriverOtherError(
'SMF restart failed. Please check you'
' k8s-cluster environment.')
commander.close_session()
os.remove(local_upf_path)
os.remove(local_smf_path)
@log.log
def terminate_start(self, context, vnf_instance,
terminate_vnf_request, grant,
grant_request, **kwargs):
pass
@log.log
def terminate_end(self, context, vnf_instance,
terminate_vnf_request, grant,
grant_request, **kwargs):
pass
@log.log
def scale_start(self, context, vnf_instance,
scale_vnf_request, grant,
grant_request, **kwargs):
pass
@log.log
def scale_end(self, context, vnf_instance,
scale_vnf_request, grant,
grant_request, **kwargs):
additional_param = vnf_instance.instantiated_vnf_info.\
additional_params.get('free5gc', {})
ssh_master_node_ip = additional_param.get('ssh_master_node_ip')
master_node_username = additional_param.get('master_node_username')
master_node_password = additional_param.get('master_node_password')
if not additional_param.get('upf_config_file_path'):
upf_config_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
if not additional_param.get('smf_config_file_path'):
smf_config_file_path = '/go/src/free5gc/config/smfcfg.yaml'
commander = cmd_executer.RemoteCommandExecutor(
user=master_node_username, password=master_node_password,
host=ssh_master_node_ip,
timeout=30)
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
# get upf2's ip from smfcfg.yaml
ssh_command = ("kubectl cp {smf_pod_name}:{smf_config_file_path}"
" /tmp/smfcfg.yaml -c myapp-container"
.format(smf_pod_name=smf_pod_name,
smf_config_file_path=smf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_smf_path = '/tmp/smfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/smfcfg.yaml', local_smf_path, 'receive')
upf_gtpu_list = []
with open(local_smf_path) as f:
file_content = yaml.safe_load(f)
upf_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF2']['node_id']
upf_gtpu_interface_list = file_content['configuration'][
'userplane_information']['up_nodes']['UPF2']['interfaces']
for upf_gtpu_interface in upf_gtpu_interface_list:
upf_gtpu_list = (upf_gtpu_interface['endpoints'] +
upf_gtpu_list)
# modify upf2's config file
ssh_command = "kubectl get pod | grep upf | awk '{print $5}'"
upf_pod_age_list = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
count = 1
age_all = {}
age_day = 0
age_h = 0
age_m = 0
age_s = 0
for age in upf_pod_age_list:
if 'd' in age:
age_day = age.split('d')[0]
if 'h' in age:
age_h = age.split('d')[1].split('h')[0]
elif 'h' in age and not age_h:
age_h = age.split('h')[0]
if 'm' in age:
age_m = age.split('h')[1].split('m')[0]
elif 'm' in age and not age_m:
age_m = age.split('m')[0]
if 's' in age:
age_s = age.split('m')[1].split('s')[0]
elif 's' in age and not age_s:
age_s = age.split('s')[0]
age_all[count] = \
int(age_day) * 24 * 60 * 60 + int(age_h) * 60 * 60 +\
int(age_m) * 60 + int(age_s) * 60
count = count + 1
age1 = age_all[1]
age2 = age_all[2]
if age1 > age2:
scale_count = 1
else:
scale_count = 0
ssh_command = ("kubectl get pod | grep upf | grep Running | awk '{"
"print $1}'")
upf_pod_name_list = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
upf2_pod_name = upf_pod_name_list[scale_count].replace('\n', '')
upf_example_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
ssh_command = ("kubectl cp {upf_pod_name}:{upf_example_file_path}"
" /tmp/upfcfg.yaml -c myapp-container"
.format(upf_pod_name=upf2_pod_name,
upf_example_file_path=upf_example_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_upf_path = '/tmp/upfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'receive')
with open(local_upf_path, 'r') as f:
upf_content = yaml.safe_load(f)
upf_content['configuration']['pfcp'][0]['addr'] = upf_pfcp_ip
for index in range(len(upf_gtpu_list)):
upf_content['configuration']['gtpu'][index]['addr'] = \
upf_gtpu_list[index]
with open(local_upf_path, 'w') as nf:
yaml.safe_dump(upf_content, nf, default_flow_style=False)
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'send')
ssh_command = ("kubectl cp /tmp/upfcfg.yaml"
" {upf_pod_name}:{upf_config_file_path} "
"-c myapp-container"
.format(upf_pod_name=upf2_pod_name,
upf_config_file_path=upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = ("kubectl exec {upf2_pod_name} -c myapp-container -- "
"ifconfig eth1 {ip}/24"
.format(upf2_pod_name=upf2_pod_name,
ip=upf_gtpu_list[0]))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = ("kubectl exec {upf2_pod_name} -c myapp-container -- "
"ifconfig eth2 {ip}/23"
.format(upf2_pod_name=upf2_pod_name, ip=upf_pfcp_ip))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = ("kubectl exec {upf2_pod_name} -c myapp-container -- "
"ifconfig eth3 192.168.52.253/24"
.format(upf2_pod_name=upf2_pod_name))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# start upf process
ssh_command = ('cat <<EOF | sudo tee "run_upf2.sh" >/dev/null\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'ip link delete upfgtp\neof\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'./NFs/upf/build/bin/free5gc-upfd -f {}\neof'
'\nEOF\n'.format(upf2_pod_name, upf2_pod_name,
upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "sudo chmod 777 run_upf2.sh"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "nohup ./run_upf2.sh > upf2.txt 2>&1 &"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# restrat smf process
ssh_command = "kubectl get pod {} -o yaml | " \
"kubectl replace --force -f -".format(smf_pod_name)
self._execute_command(
commander, ssh_command, 120,
'common', 0)
time.sleep(120)
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = "kubectl get pod {} | " \
"grep 'Running'".format(smf_pod_name)
result = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 0)
if not result:
LOG.error('SMF restart failed. Please check'
' you k8s-cluster environment.')
raise exceptions.MgmtDriverOtherError(
'SMF restart failed. Please check you'
' k8s-cluster environment.')
commander.close_session()
os.remove(local_smf_path)
os.remove(local_upf_path)
# if pod-affinity rule exists, check the pod deployed on different
# worker
affinity_flag = False
artifact_files = vnf_instance.instantiated_vnf_info.\
additional_params.get('lcm-kubernetes-def-files', {})
vnf_package_path = vnflcm_utils._get_vnf_package_path(
context, vnf_instance.vnfd_id)
for artifact_file in artifact_files:
if 'upf' in artifact_file:
upf_file_path = os.path.join(
vnf_package_path, artifact_file)
LOG.debug('upf_path:{}'.format(upf_file_path))
with open(upf_file_path) as f:
yaml_content_all = yaml.safe_load_all(f.read())
for yaml_content in yaml_content_all:
if (yaml_content['spec']['template']['spec']
.get('affinity')):
affinity_rule = (yaml_content['spec']['template']
['spec'].get('affinity'))
if affinity_rule.get('podAntiAffinity'):
affinity_flag = True
LOG.debug('affinity_flag:{}'.format(affinity_flag))
if affinity_flag:
commander = cmd_executer.RemoteCommandExecutor(
user=master_node_username, password=master_node_password,
host=ssh_master_node_ip,
timeout=30)
ssh_command = ("kubectl get pod -o wide | grep 'upf' | awk '{"
"print $7}'")
result = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 0)
if result[0] == result[1]:
LOG.error('The pod-affinity rule doesn\'t worker.'
' Please check your yaml file {}'.format(
upf_file_path))
raise exceptions.MgmtDriverOtherError(
'The pod-affinity rule doesn\'t worker.'
' Please check your yaml file {}'.format(
upf_file_path))
else:
LOG.debug('The pod has deployed on different worker node.')
@log.log
def heal_start(self, context, vnf_instance,
heal_vnf_request, grant,
grant_request, **kwargs):
pass
@log.log
def heal_end(self, context, vnf_instance,
heal_vnf_request, grant,
grant_request, **kwargs):
additional_param = vnf_instance.instantiated_vnf_info. \
additional_params.get('free5gc', {})
ssh_master_node_ip = additional_param.get('ssh_master_node_ip')
master_node_username = additional_param.get('master_node_username')
master_node_password = additional_param.get('master_node_password')
if not additional_param.get('smf_config_file_path'):
smf_config_file_path = '/go/src/free5gc/config/smfcfg.yaml'
if not additional_param.get('upf_config_file_path'):
upf_config_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
commander = cmd_executer.RemoteCommandExecutor(
user=master_node_username, password=master_node_password,
host=ssh_master_node_ip,
timeout=30)
ssh_command = "kubectl get pod | grep upf | awk '{print $5}'"
upf_pod_age_list = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
if len(upf_pod_age_list) > 1:
# get upf ip
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = ("kubectl cp {smf_pod_name}:{smf_config_file_path}"
" /tmp/smfcfg.yaml -c myapp-container"
.format(smf_pod_name=smf_pod_name,
smf_config_file_path=smf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_smf_path = '/tmp/smfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/smfcfg.yaml', local_smf_path, 'receive')
with open(local_smf_path) as f:
file_content = yaml.safe_load(f)
upf1_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF']['node_id']
upf2_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF2']['node_id']
ssh_command = "kubectl get pod | grep upf | awk '{print $1}'"
upf_pod_name_list = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
for upf_pod in upf_pod_name_list:
upf_example_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
ssh_command = "kubectl exec {} -c myapp-container --" \
" cat {}".format(upf_pod.replace('\n', ''),
upf_example_file_path)
results = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
for result in results:
if upf1_pfcp_ip in result:
flag = 'UPF2'
unhealed_upf_pod_name = upf_pod
break
if upf2_pfcp_ip in result:
flag = 'UPF'
unhealed_upf_pod_name = upf_pod
upf_pod_name_list.remove(unhealed_upf_pod_name)
upf_pod_name = upf_pod_name_list[0].replace('\n', '')
upf_gtpu_list = []
with open(local_smf_path) as f:
file_content = yaml.safe_load(f)
if flag == 'UPF':
upf_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF']['node_id']
upf_gtpu_interface_list = (
file_content['configuration']['userplane_information']
['up_nodes']['UPF']['interfaces'])
for upf_gtpu_interface in upf_gtpu_interface_list:
upf_gtpu_list = (upf_gtpu_interface['endpoints'] +
upf_gtpu_list)
else:
upf_pfcp_ip = file_content['configuration'][
'userplane_information']['up_nodes']['UPF2']['node_id']
upf_gtpu_interface_list = (
file_content['configuration']['userplane_information']
['up_nodes']['UPF2']['interfaces'])
for upf_gtpu_interface in upf_gtpu_interface_list:
upf_gtpu_list = (upf_gtpu_interface['endpoints'] +
upf_gtpu_list)
# modify upf config file
upf_example_file_path = \
'/go/src/free5gc/NFs/upf/build/config/upfcfg.yaml'
ssh_command = ("kubectl cp {upf_pod_name}:{upf_example_file_path}"
" /tmp/upfcfg.yaml -c myapp-container".format(
upf_pod_name=upf_pod_name,
upf_example_file_path=upf_example_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
local_upf_path = '/tmp/upfcfg.yaml'
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'receive')
with open(local_upf_path, 'r') as f:
upf_content = yaml.safe_load(f)
upf_content['configuration']['pfcp'][0]['addr'] = upf_pfcp_ip
for index in range(len(upf_gtpu_list)):
upf_content['configuration']['gtpu'][index]['addr'] = \
upf_gtpu_list[index]
with open(local_upf_path, 'w') as nf:
yaml.safe_dump(upf_content, nf, default_flow_style=False)
self._send_and_receive_file(
ssh_master_node_ip, master_node_username, master_node_password,
'/tmp/upfcfg.yaml', local_upf_path, 'send')
ssh_command = ("kubectl cp /tmp/upfcfg.yaml"
" {upf_pod_name}:{upf_config_file_path}"
" -c myapp-container"
.format(upf_pod_name=upf_pod_name,
upf_config_file_path=upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# start upf process
ssh_command = ('cat <<EOF | sudo tee "run_upf.sh" >/dev/null\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'ip link delete upfgtp\neof\n'
'kubectl exec'
' {} -i -- sh'
'<< eof\n'
'./NFs/upf/build/bin/free5gc-upfd -f {}\neof'
'\nEOF\n'
.format(upf_pod_name, upf_pod_name,
upf_config_file_path))
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "sudo chmod 777 run_upf.sh"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
ssh_command = "nohup ./run_upf.sh > upf_heal.txt 2>&1 &"
self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)
# restart smf
ssh_command = "kubectl get pod {} -o yaml | " \
"kubectl replace --force -f -".format(smf_pod_name)
self._execute_command(
commander, ssh_command, 120,
'common', 0)
time.sleep(120)
ssh_command = "kubectl get pod | grep smf | awk '{print $1}'"
smf_pod_name = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 3)[0].replace('\n', '')
ssh_command = "kubectl get pod {} | " \
"grep 'Running'".format(smf_pod_name)
result = self._execute_command(
commander, ssh_command, FREE5GC_CMD_TIMEOUT,
'common', 0)
if not result:
LOG.error('SMF restart failed. Please check'
' you k8s-cluster environment.')
raise exceptions.MgmtDriverOtherError(
'SMF restart failed. Please check you'
' k8s-cluster environment.')
commander.close_session()
os.remove(local_upf_path)
os.remove(local_smf_path)
else:
self.instantiate_end(context, vnf_instance,
vnf_instance.instantiated_vnf_info, grant,
grant_request, **kwargs)
@log.log
def change_external_connectivity_start(
self, context, vnf_instance,
change_ext_conn_request, grant,
grant_request, **kwargs):
pass
@log.log
def change_external_connectivity_end(
self, context, vnf_instance,
change_ext_conn_request, grant,
grant_request, **kwargs):
pass

View File

@@ -0,0 +1,74 @@
TOSCA-Meta-File-Version: 1.0
Created-by: dummy_user
CSAR-Version: 1.1
Entry-Definitions: Definitions/free5gc_top.vnfd.yaml
Name: Files/kubernetes/free5gc-amf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: 9ff05bcde8a286273eb9ff6b24250cc9e57be9e7e032faf8293691e18cfa6aa0
Name: Files/kubernetes/free5gc-ausf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: b47b97941ce0815dc0c80317e5323d51d29f1937fab37ef47d081652f0773100
Name: Files/kubernetes/free5gc-configmap.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: cdee7916e30fb98775b493c42a3cc8a40b2db5a0e478767609deeb0c0d3aec9d
Name: Files/kubernetes/free5gc-mongodb.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: ec2ee0dc124c573ff0af795ce36ed83358ad026099c576769612e79cde3bf4d4
Name: Files/kubernetes/free5gc-nrf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: e7042c937431aa3d65a01b5602adb23a98a280c8575dc54f02ab50e4174cf2dc
Name: Files/kubernetes/free5gc-nssf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: e871ac354e333a3c038b202f5014fcd56068ded2a2f7317e529d1585a3327d60
Name: Files/kubernetes/free5gc-pcf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: 43e3307266eea8a95f90a27848d719820c2aa6c5d13e741e5e83cb94e36bec8f
Name: Files/kubernetes/free5gc-smf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: ce9e16e8418967d265430a7ed77736f85cba317098d9b526293f09babd24ed72
Name: Files/kubernetes/free5gc-udm.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: d5b451fcb0d66c38f8312e515f882f3fe7d4bae4cf17991bb6142670b70d2224
Name: Files/kubernetes/free5gc-udr.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: c44011cbf73ea59f021326620612142e0455116f7d1ec86234ab319e2c9db131
Name: Files/kubernetes/free5gc-upf.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: 2ea6b86e65f41a7327f2a4af410cc619be67edff00329ecf12bc842c0a007707
Name: Files/kubernetes/free5gc-webui.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: a2e33991eacd9235717e958e02aecfd59fa07b95844c699cb1d85df99a449125
Name: Files/kubernetes/unix-daemonset.yaml
Content-Type: application/yaml
Algorithm: SHA-256
Hash: cf3d6b578c568e730d9f392754fb644b6c10e1096a29cb47105f8e396f047dff
Name: Scripts/free5gc_mgmt_cnf.py
Content-Type: text/x-python
Algorithm: SHA-256
Hash: <caculate here>

View File

@@ -0,0 +1,32 @@
{
"flavourId": "simple",
"additionalParams": {
"free5gc": {
"ssh_master_node_ip": "10.10.0.166",
"master_node_username": "ubuntu",
"master_node_password": "ubuntu",
},
"lcm-kubernetes-def-files": [
"Files/kubernetes/unix-daemonset.yaml",
"Files/kubernetes/free5gc-configmap.yaml",
"Files/kubernetes/free5gc-mongodb.yaml",
"Files/kubernetes/free5gc-nrf.yaml",
"Files/kubernetes/free5gc-udr.yaml",
"Files/kubernetes/free5gc-upf.yaml",
"Files/kubernetes/free5gc-pcf.yaml",
"Files/kubernetes/free5gc-ausf.yaml",
"Files/kubernetes/free5gc-nssf.yaml",
"Files/kubernetes/free5gc-udm.yaml",
"Files/kubernetes/free5gc-amf.yaml",
"Files/kubernetes/free5gc-webui.yaml",
"Files/kubernetes/free5gc-smf.yaml",
],
},
"vimConnectionInfo": [
{
"id": "kubernetes_vim",
"vimId": "9b723654-33cf-4c76-b3dd-904510f5499d",
"vimType": "kubernetes",
},
],
}