diff --git a/Dockerfile b/Dockerfile index 12c68eb..55d97c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Build the manager binary -FROM golang:1.20 as builder +FROM golang:1.20 AS builder ARG TARGETOS ARG TARGETARCH @@ -16,6 +16,7 @@ COPY cmd/main.go cmd/main.go COPY internal/controller/ internal/controller/ COPY api api + # Build # the GOARCH has not a default value to allow the binary be built according to the host where the command # was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO diff --git a/internal/controller/randeployment_controller.go b/internal/controller/randeployment_controller.go index 6b7728f..54d2b92 100644 --- a/internal/controller/randeployment_controller.go +++ b/internal/controller/randeployment_controller.go @@ -236,9 +236,9 @@ func (r *RANDeploymentReconciler) GetConfigs(ctx context.Context, ranDeployment // For more details, check Reconcile and its Result here: // - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.15.0/pkg/reconcile func (r *RANDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { - logger := log.FromContext(ctx).WithValues("RANDeployment", req.NamespacedName) logger.Info("Reconcile for RANDeployment") + instance := &workloadv1alpha1.NFDeployment{} err := r.Get(ctx, req.NamespacedName, instance) if err != nil { @@ -246,6 +246,7 @@ func (r *RANDeploymentReconciler) Reconcile(ctx context.Context, req ctrl.Reques logger.Info("RANDeployment resource not found, ignoring because object must be deleted") return ctrl.Result{}, nil } + logger.Error(err, "Failed to get RANDeployment") return ctrl.Result{}, err } diff --git a/internal/controller/resources_cucp.go b/internal/controller/resources_cucp.go index f20313e..866ce3a 100644 --- a/internal/controller/resources_cucp.go +++ b/internal/controller/resources_cucp.go @@ -123,7 +123,7 @@ func (resource CuCpResources) GetConfigMap(log logr.Logger, ranDeployment *workl configMap1 := &corev1.ConfigMap{ Data: map[string]string{ - "mounted.conf": configuration, + "gnb.conf": configuration, }, ObjectMeta: metav1.ObjectMeta{ Name: "oai-gnb-cu-cp-configmap", @@ -205,8 +205,8 @@ func (resource CuCpResources) GetDeployment(log logr.Logger, ranDeployment *work corev1.VolumeMount{ Name: "configuration", ReadOnly: false, - SubPath: "mounted.conf", - MountPath: "/opt/oai-gnb/etc/mounted.conf", + SubPath: "gnb.conf", + MountPath: "/opt/oai-gnb/etc/gnb.conf", }, }, Env: []corev1.EnvVar{ diff --git a/internal/controller/resources_cucp_test.go b/internal/controller/resources_cucp_test.go index e569a79..9c11bbd 100644 --- a/internal/controller/resources_cucp_test.go +++ b/internal/controller/resources_cucp_test.go @@ -589,8 +589,8 @@ func TestGetConfigMapCuCp(t *testing.T) { NSSAI_SD: *tc.paramsPlmn.Spec.PLMNInfo[0].NSSAI[0].SD, }) - if !reflect.DeepEqual(got[0].Data["mounted.conf"], defaultWantConfigurations) { - t.Errorf("GetConfigMap returned %s Wanted %s", got[0].Data["mounted.conf"], defaultWantConfigurations) + if !reflect.DeepEqual(got[0].Data["gnb.conf"], defaultWantConfigurations) { + t.Errorf("GetConfigMap returned %s Wanted %s", got[0].Data["gnb.conf"], defaultWantConfigurations) } } else { if got != nil { diff --git a/internal/controller/resources_cuup.go b/internal/controller/resources_cuup.go index 5718905..132c458 100644 --- a/internal/controller/resources_cuup.go +++ b/internal/controller/resources_cuup.go @@ -97,10 +97,10 @@ func (resource CuUpResources) GetDeployment(log logr.Logger, ranDeployment *work VolumeMounts: []corev1.VolumeMount{ corev1.VolumeMount{ - MountPath: "/opt/oai-gnb/etc/mounted.conf", + MountPath: "/opt/oai-gnb/etc/gnb.conf", Name: "configuration", ReadOnly: false, - SubPath: "mounted.conf", + SubPath: "gnb.conf", }, }, Env: []corev1.EnvVar{ @@ -111,7 +111,7 @@ func (resource CuUpResources) GetDeployment(log logr.Logger, ranDeployment *work }, corev1.EnvVar{ Name: "USE_ADDITIONAL_OPTIONS", - Value: "--sa", + Value: "--sa --log_config.global_log_options level,nocolor,time", }, corev1.EnvVar{ Name: "USE_VOLUMED_CONF", @@ -259,7 +259,7 @@ func (resource CuUpResources) GetConfigMap(log logr.Logger, ranDeployment *workl Kind: "ConfigMap", }, Data: map[string]string{ - "mounted.conf": configuration, + "gnb.conf": configuration, }, } diff --git a/internal/controller/resources_cuup_test.go b/internal/controller/resources_cuup_test.go index 7e36fdd..cfd62fe 100644 --- a/internal/controller/resources_cuup_test.go +++ b/internal/controller/resources_cuup_test.go @@ -510,8 +510,8 @@ func TestGetConfigMapCuUp(t *testing.T) { t.Errorf("GetConfigMap CuUp returned %v Wanted nil", got) } } else { - if got[0].Data["mounted.conf"] != tc.wantedConfiguration { - t.Errorf("GetConfigMap CuUp returned %v Wanted %v", got[0].Data["mounted.conf"], tc.wantedConfiguration) + if got[0].Data["gnb.conf"] != tc.wantedConfiguration { + t.Errorf("GetConfigMap CuUp returned %v Wanted %v", got[0].Data["gnb.conf"], tc.wantedConfiguration) } } diff --git a/internal/controller/resources_du.go b/internal/controller/resources_du.go index 3bb6747..5198eda 100644 --- a/internal/controller/resources_du.go +++ b/internal/controller/resources_du.go @@ -24,6 +24,7 @@ import ( workloadv1alpha1 "github.com/nephio-project/api/workload/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/core/v1" + resourcev1 "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/utils/pointer" @@ -98,7 +99,7 @@ func (resource DuResources) GetConfigMap(log logr.Logger, ranDeployment *workloa configMap1 := &corev1.ConfigMap{ Data: map[string]string{ - "mounted.conf": configuration, + "gnb.conf": configuration, }, ObjectMeta: metav1.ObjectMeta{ Name: "oai-gnb-du-configmap", @@ -113,7 +114,6 @@ func (resource DuResources) GetConfigMap(log logr.Logger, ranDeployment *workloa } func (resource DuResources) GetDeployment(log logr.Logger, ranDeployment *workloadv1alpha1.NFDeployment, configInfo *ConfigInfo) []*appsv1.Deployment { - spec := ranDeployment.Spec networkAttachmentDefinitionNetworks, err := resource.createNetworkAttachmentDefinitionNetworks(ranDeployment.Name, &spec) @@ -178,22 +178,10 @@ func (resource DuResources) GetDeployment(log logr.Logger, ranDeployment *worklo corev1.Container{ Env: []corev1.EnvVar{ - - corev1.EnvVar{ - Name: "TZ", - Value: "Europe/Paris", - }, - corev1.EnvVar{ - Name: "RFSIMULATOR", - Value: "server", - }, - corev1.EnvVar{ - Name: "USE_ADDITIONAL_OPTIONS", - Value: "--sa --rfsim --log_config.global_log_options level,nocolor,time", - }, corev1.EnvVar{ - Name: "USE_VOLUMED_CONF", - Value: "yes", + Name: "USE_ADDITIONAL_OPTIONS", + Value: "--sa --rfsim --log_config.global_log_options level,nocolor,time" + + " --telnetsrv --telnetsrv.shrmod o1 --telnetsrv.listenaddr 192.168.74.2", }, }, Image: paramsOAI.Spec.Image, @@ -210,6 +198,16 @@ func (resource DuResources) GetDeployment(log logr.Logger, ranDeployment *worklo Protocol: corev1.Protocol("UDP"), }, }, + Resources: corev1.ResourceRequirements{ + Limits: corev1.ResourceList{ + corev1.ResourceCPU: resourcev1.MustParse("2000m"), + corev1.ResourceMemory: resourcev1.MustParse("2Gi"), + }, + Requests: corev1.ResourceList{ + corev1.ResourceCPU: resourcev1.MustParse("2000m"), + corev1.ResourceMemory: resourcev1.MustParse("1Gi"), + }, + }, Stdin: false, TTY: false, VolumeMounts: []corev1.VolumeMount{ @@ -217,8 +215,8 @@ func (resource DuResources) GetDeployment(log logr.Logger, ranDeployment *worklo corev1.VolumeMount{ Name: "configuration", ReadOnly: false, - SubPath: "mounted.conf", - MountPath: "/opt/oai-gnb/etc/mounted.conf", + SubPath: "gnb.conf", + MountPath: "/opt/oai-gnb/etc/gnb.conf", }, }, Name: "gnbdu", @@ -309,5 +307,35 @@ func (resource DuResources) GetService() []*corev1.Service { }, } - return []*corev1.Service{service1} + // O1-Telent Service + service2 := &corev1.Service{ + TypeMeta: metav1.TypeMeta{ + APIVersion: "v1", + Kind: "Service", + }, + ObjectMeta: metav1.ObjectMeta{ + Labels: map[string]string{ + "app.kubernetes.io/name": "oai-gnb-du-o1-telnet-lb", + }, + Name: "oai-gnb-du-o1-telnet-lb", + }, + Spec: corev1.ServiceSpec{ + Selector: map[string]string{ + "app.kubernetes.io/name": "oai-gnb-du", + }, + Type: corev1.ServiceType("LoadBalancer"), + Ports: []corev1.ServicePort{ + corev1.ServicePort{ + Port: 9090, + Protocol: corev1.Protocol("TCP"), + NodePort: 32500, + TargetPort: intstr.IntOrString{ + IntVal: 9090, + }, + }, + }, + }, + } + + return []*corev1.Service{service1, service2} } diff --git a/internal/controller/resources_du_test.go b/internal/controller/resources_du_test.go index c6464c1..390711c 100644 --- a/internal/controller/resources_du_test.go +++ b/internal/controller/resources_du_test.go @@ -351,8 +351,8 @@ func TestGetConfigMapDu(t *testing.T) { NSSAI_SD: *tc.paramsPlmn.Spec.PLMNInfo[0].NSSAI[0].SD, }) - if !reflect.DeepEqual(got[0].Data["mounted.conf"], defaultWantConfigurations) { - t.Errorf("GetConfigMap returned %s Wanted %s", got[0].Data["mounted.conf"], defaultWantConfigurations) + if !reflect.DeepEqual(got[0].Data["gnb.conf"], defaultWantConfigurations) { + t.Errorf("GetConfigMap returned %s Wanted %s", got[0].Data["gnb.conf"], defaultWantConfigurations) } } else { if got != nil { diff --git a/internal/controller/templates.go b/internal/controller/templates.go index 6990aee..791d321 100644 --- a/internal/controller/templates.go +++ b/internal/controller/templates.go @@ -21,576 +21,11 @@ import ( "text/template" ) -const configurationTemplateSourceForCuCp = ` -Active_gNBs = ( "oai-cu-cp"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; -Num_Threads_PUSCH = 8; -sa = 1; - -gNBs = -( - { - ////////// Identification parameters: - gNB_CU_ID = 0xe00; - -# cell_type = "CELL_MACRO_GNB"; - - gNB_name = "oai-cu-cp"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = {{ .TAC }}; - plmn_list = ({ mcc = {{ .PLMN_MCC }}; - mnc = {{ .PLMN_MNC }}; - mnc_length ={{ .PLMN_MNC_LENGTH }}; - snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) - }); - - - nr_cellid = {{ .CELL_ID }}; - force_256qam_off = 1; - - tr_s_preference = "f1"; - - local_s_if_name = "f1c"; - local_s_address = {{ .F1C_IP }}; - remote_s_address = "0.0.0.0"; - local_s_portc = 501; - local_s_portd = 2152; - remote_s_portc = 500; - remote_s_portd = 2152; - - ssb_SubcarrierOffset = 0; - min_rxtxtime = 6; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = {{ .PHY_CELL_ID }}; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = {{ .DL_FREQ_BAND }}; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = {{ .DL_SCS }}; - dl_carrierBandwidth = {{ .DL_CARRIER_BW }}; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 11; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = {{ .UL_FREQ_BAND }}; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = {{ .UL_SCS }}; - ul_carrierBandwidth = {{ .UL_CARRIER_BW }}; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - - ////////// AMF parameters: - amf_ip_address = ( { ipv4 = {{ .AMF_IP }}; - ipv6 = "0:0:0::0"; - active = "yes"; - preference = "ipv4"; - } - ); - - E1_INTERFACE = - ( - { - type = "cp"; - ipv4_cucp = {{ .E1_IP }}; - port_cucp = 38462; - ipv4_cuup = "0.0.0.0"; - port_cuup = 38462; - } - ) - - NETWORK_INTERFACES : - { - GNB_INTERFACE_NAME_FOR_NG_AMF = "n2"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = {{ .N2_IP }}; - }; - } -); - -security = { - # preferred ciphering algorithms - # the first one of the list that an UE supports in chosen - # valid values: nea0, nea1, nea2, nea3 - ciphering_algorithms = ( "nea0" ); - - # preferred integrity algorithms - # the first one of the list that an UE supports in chosen - # valid values: nia0, nia1, nia2, nia3 - integrity_algorithms = ( "nia2", "nia0" ); - - # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter - # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' - drb_ciphering = "yes"; - drb_integrity = "no"; -}; - log_config : - { - global_log_level ="info"; - hw_log_level ="info"; - phy_log_level ="info"; - mac_log_level ="info"; - rlc_log_level ="debug"; - pdcp_log_level ="info"; - rrc_log_level ="info"; - f1ap_log_level ="info"; - ngap_log_level ="debug"; - }; - -` -const configurationTemplateSourceForCuUp = ` -Active_gNBs = ( "oai-cu-up"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; -sa = 1; -gNBs = -( - { - ////////// Identification parameters: - gNB_CU_ID = 0xe00; - -# cell_type = "CELL_MACRO_GNB"; - - gNB_name = "oai-cu-up"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = {{ .TAC }}; - plmn_list = ({ mcc = {{ .PLMN_MCC }}; - mnc = {{ .PLMN_MNC }}; - mnc_length ={{ .PLMN_MNC_LENGTH }}; - snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) - }); - - tr_s_preference = "f1"; - - local_s_if_name = "f1u"; - local_s_address = {{ .F1U_IP }}; - remote_s_address = "0.0.0.0"; - local_s_portc = 501; - local_s_portd = 2152; - remote_s_portc = 500; - remote_s_portd = 2152; - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - - E1_INTERFACE = - ( - { - type = "up"; - ipv4_cucp = {{ .CUCP_E1 }}; - ipv4_cuup = {{ .E1_IP }}; - } - ) - - NETWORK_INTERFACES : - { - GNB_INTERFACE_NAME_FOR_NG_AMF = "n3"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = {{ .N3_IP }}; - GNB_INTERFACE_NAME_FOR_NGU = "n3"; - GNB_IPV4_ADDRESS_FOR_NGU = {{ .N3_IP }}; - GNB_PORT_FOR_S1U = 2152; # Spec 2152 - }; - } -); - -security = { - # preferred ciphering algorithms - # the first one of the list that an UE supports in chosen - # valid values: nea0, nea1, nea2, nea3 - ciphering_algorithms = ( "nea0" ); - - # preferred integrity algorithms - # the first one of the list that an UE supports in chosen - # valid values: nia0, nia1, nia2, nia3 - integrity_algorithms = ( "nia2", "nia0" ); - - # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter - # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' - drb_ciphering = "yes"; - drb_integrity = "no"; -}; - log_config : - { - global_log_level ="info"; - hw_log_level ="info"; - phy_log_level ="info"; - mac_log_level ="info"; - rlc_log_level ="debug"; - pdcp_log_level ="info"; - rrc_log_level ="info"; - f1ap_log_level ="info"; - ngap_log_level ="debug"; - }; -` -const configurationTemplateSourceForDu = ` -Active_gNBs = ( "oai-du-rfsim"); -# Asn1_verbosity, choice in: none, info, annoying -Asn1_verbosity = "none"; - -gNBs = -( - { - ////////// Identification parameters: - gNB_ID = 0xe00; - -# cell_type = "CELL_MACRO_GNB"; - - gNB_name = "oai-du-rfsim"; - - // Tracking area code, 0x0000 and 0xfffe are reserved values - tracking_area_code = {{ .TAC }}; - plmn_list = ({ mcc = {{ .PLMN_MCC }}; mnc = {{ .PLMN_MNC }}; mnc_length = {{ .PLMN_MNC_LENGTH }}; snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) }); - - - nr_cellid = {{ .CELL_ID }}; - - ////////// Physical parameters: - - min_rxtxtime = 6; - force_256qam_off = 1; - - servingCellConfigCommon = ( - { - #spCellConfigCommon - - physCellId = {{ .PHY_CELL_ID }}; - -# downlinkConfigCommon - #frequencyInfoDL - # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) - absoluteFrequencySSB = 641280; - dl_frequencyBand = {{ .DL_FREQ_BAND }}; - # this is 3600 MHz - dl_absoluteFrequencyPointA = 640008; - #scs-SpecificCarrierList - dl_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - dl_subcarrierSpacing = {{ .DL_SCS }}; - dl_carrierBandwidth = {{ .DL_CARRIER_BW }}; - #initialDownlinkBWP - #genericParameters - # this is RBstart=27,L=48 (275*(L-1))+RBstart - initialDLBWPlocationAndBandwidth = 28875; # 6366 12925 12956 28875 12952 -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialDLBWPsubcarrierSpacing = 1; - #pdcch-ConfigCommon - initialDLBWPcontrolResourceSetZero = 12; - initialDLBWPsearchSpaceZero = 0; - - #uplinkConfigCommon - #frequencyInfoUL - ul_frequencyBand = {{ .UL_FREQ_BAND }}; - #scs-SpecificCarrierList - ul_offstToCarrier = 0; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - ul_subcarrierSpacing = {{ .UL_SCS }}; - ul_carrierBandwidth = {{ .UL_CARRIER_BW }}; - pMax = 20; - #initialUplinkBWP - #genericParameters - initialULBWPlocationAndBandwidth = 28875; -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - initialULBWPsubcarrierSpacing = 1; - #rach-ConfigCommon - #rach-ConfigGeneric - prach_ConfigurationIndex = 98; -#prach_msg1_FDM -#0 = one, 1=two, 2=four, 3=eight - prach_msg1_FDM = 0; - prach_msg1_FrequencyStart = 0; - zeroCorrelationZoneConfig = 13; - preambleReceivedTargetPower = -96; -#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) - preambleTransMax = 6; -#powerRampingStep -# 0=dB0,1=dB2,2=dB4,3=dB6 - powerRampingStep = 1; -#ra_ReponseWindow -#1,2,4,8,10,20,40,80 - ra_ResponseWindow = 4; -#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR -#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen - ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; -#oneHalf (0..15) 4,8,12,16,...60,64 - ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; -#ra_ContentionResolutionTimer -#(0..7) 8,16,24,32,40,48,56,64 - ra_ContentionResolutionTimer = 7; - rsrp_ThresholdSSB = 19; -#prach-RootSequenceIndex_PR -#1 = 839, 2 = 139 - prach_RootSequenceIndex_PR = 2; - prach_RootSequenceIndex = 1; - # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex - # - msg1_SubcarrierSpacing = 1, -# restrictedSetConfig -# 0=unrestricted, 1=restricted type A, 2=restricted type B - restrictedSetConfig = 0, - - msg3_DeltaPreamble = 1; - p0_NominalWithGrant =-90; - -# pucch-ConfigCommon setup : -# pucchGroupHopping -# 0 = neither, 1= group hopping, 2=sequence hopping - pucchGroupHopping = 0; - hoppingId = 40; - p0_nominal = -90; -# ssb_PositionsInBurs_BitmapPR -# 1=short, 2=medium, 3=long - ssb_PositionsInBurst_PR = 2; - ssb_PositionsInBurst_Bitmap = 1; - -# ssb_periodicityServingCell -# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 - ssb_periodicityServingCell = 2; - -# dmrs_TypeA_position -# 0 = pos2, 1 = pos3 - dmrs_TypeA_Position = 0; - -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - subcarrierSpacing = 1; - - - #tdd-UL-DL-ConfigurationCommon -# subcarrierSpacing -# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 - referenceSubcarrierSpacing = 1; - # pattern1 - # dl_UL_TransmissionPeriodicity - # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 - dl_UL_TransmissionPeriodicity = 6; - nrofDownlinkSlots = 7; - nrofDownlinkSymbols = 6; - nrofUplinkSlots = 2; - nrofUplinkSymbols = 4; - - ssPBCH_BlockPower = -25; - } - - ); - - - # ------- SCTP definitions - SCTP : - { - # Number of streams to use in input/output - SCTP_INSTREAMS = 2; - SCTP_OUTSTREAMS = 2; - }; - } -); - -MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "f1"; - local_n_if_name = "f1"; - local_n_address = {{ .F1C_DU_IP }}; - remote_n_address = {{ .F1C_CU_IP }}; - local_n_portc = 500; - local_n_portd = 2152; - remote_n_portc = 501; - remote_n_portd = 2152; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 200; - ulsch_max_frame_inactivity = 1; - } -); - -L1s = ( -{ - num_cc = 1; - tr_n_preference = "local_mac"; - prach_dtx_threshold = 200; - pucch0_dtx_threshold = 150; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 -} -); - -RUs = ( - { - local_rf = "yes" - nb_tx = 1 - nb_rx = 1 - att_tx = 0 - att_rx = 0; - bands = [78]; - max_pdschReferenceSignalPower = -27; - max_rxgain = 114; - eNB_instances = [0]; - #beamforming 1x4 matrix: - bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; - clock_src = "internal"; - } -); - -THREAD_STRUCT = ( - { - #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" - parallel_config = "PARALLEL_SINGLE_THREAD"; - #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" - worker_config = "WORKER_ENABLE"; - } -); -rfsimulator: { -serveraddr = "server"; - serverport = "4043"; - options = (); #("saviq"); or/and "chanmod" - modelname = "AWGN"; - IQfile = "/tmp/rfsimulator.iqs" -} - - log_config : - { - global_log_level ="info"; - hw_log_level ="info"; - phy_log_level ="info"; - mac_log_level ="info"; - rlc_log_level ="info"; - pdcp_log_level ="info"; - rrc_log_level ="info"; - f1ap_log_level ="info"; - ngap_log_level ="debug"; - }; -` - var ( - configurationTemplateForCuCp = template.Must(template.New("RanCuCpConfiguration").Parse(configurationTemplateSourceForCuCp)) - configurationTemplateForCuUp = template.Must(template.New("RanCuUpConfiguration").Parse(configurationTemplateSourceForCuUp)) - configurationTemplateForDu = template.Must(template.New("RanDuConfiguration").Parse(configurationTemplateSourceForDu)) + // O1-Telnet + configurationTemplateForCuCpO1Telnet = template.Must(template.New("RanCuCpConfigurationO1").Parse(configurationTemplateSourceForCuCpO1Telnet)) + configurationTemplateForCuUpO1Telnet = template.Must(template.New("RanCuUpConfigurationO1").Parse(configurationTemplateSourceForCuUpO1Telnet)) + configurationTemplateForDuO1Telnet = template.Must(template.New("RanDuConfigurationO1").Parse(configurationTemplateSourceForDuO1Telnet)) ) type configurationTemplateValuesForCuCp struct { @@ -648,7 +83,8 @@ type configurationTemplateValuesForDu struct { func renderConfigurationTemplateForCuCp(values configurationTemplateValuesForCuCp) (string, error) { var buffer bytes.Buffer - if err := configurationTemplateForCuCp.Execute(&buffer, values); err == nil { + + if err := configurationTemplateForCuCpO1Telnet.Execute(&buffer, values); err == nil { return buffer.String(), nil } else { return "", err @@ -657,7 +93,8 @@ func renderConfigurationTemplateForCuCp(values configurationTemplateValuesForCuC func renderConfigurationTemplateForCuUp(values configurationTemplateValuesForCuUp) (string, error) { var buffer bytes.Buffer - if err := configurationTemplateForCuUp.Execute(&buffer, values); err == nil { + + if err := configurationTemplateForCuUpO1Telnet.Execute(&buffer, values); err == nil { return buffer.String(), nil } else { return "", err @@ -666,7 +103,7 @@ func renderConfigurationTemplateForCuUp(values configurationTemplateValuesForCuU func renderConfigurationTemplateForDu(values configurationTemplateValuesForDu) (string, error) { var buffer bytes.Buffer - if err := configurationTemplateForDu.Execute(&buffer, values); err == nil { + if err := configurationTemplateForDuO1Telnet.Execute(&buffer, values); err == nil { return buffer.String(), nil } else { return "", err diff --git a/internal/controller/templates_o1telnet.go b/internal/controller/templates_o1telnet.go new file mode 100644 index 0000000..7b2c094 --- /dev/null +++ b/internal/controller/templates_o1telnet.go @@ -0,0 +1,458 @@ +/* +Copyright 2023 The Nephio Authors. + +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. +*/ + +package controller + +const configurationTemplateSourceForCuCpO1Telnet = ` +Active_gNBs = ( "oai-cu-cp"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; +Num_Threads_PUSCH = 8; +sa = 1; + +gNBs = +( + { + ////////// Identification parameters: + // gNB_CU_ID = 0xe00; + gNB_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "oai-cu-cp"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = {{ .TAC }}; + plmn_list = ({ mcc = {{ .PLMN_MCC }}; + mnc = {{ .PLMN_MNC }}; + mnc_length ={{ .PLMN_MNC_LENGTH }}; + snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) + }); + + nr_cellid = {{ .CELL_ID }}; + // force_256qam_off = 1; + + tr_s_preference = "f1"; + + local_s_if_name = "f1c"; + local_s_address = {{ .F1C_IP }}; + remote_s_address = "0.0.0.0"; + local_s_portc = 501; + local_s_portd = 2152; + remote_s_portc = 500; + remote_s_portd = 2152; + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = {{ .AMF_IP }}; + ipv6 = "0:0:0::0"; + active = "yes"; + preference = "ipv4"; + } + ); + + E1_INTERFACE = + ( + { + type = "cp"; + ipv4_cucp = {{ .E1_IP }}; + port_cucp = 38462; + ipv4_cuup = "0.0.0.0"; + port_cuup = 38462; + } + ) + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "n2"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = {{ .N2_IP }}; + }; + } +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + log_config : + { + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="debug"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + f1ap_log_level ="info"; + ngap_log_level ="debug"; + }; + +` + +const configurationTemplateSourceForCuUpO1Telnet = ` +Active_gNBs = ( "oai-cu-up"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; +sa = 1; +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_CU_UP_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "oai-cu-up"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = {{ .TAC }}; + plmn_list = ({ mcc = {{ .PLMN_MCC }}; + mnc = {{ .PLMN_MNC }}; + mnc_length ={{ .PLMN_MNC_LENGTH }}; + snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) + }); + + tr_s_preference = "f1"; + + local_s_if_name = "f1u"; + local_s_address = {{ .F1U_IP }}; + remote_s_address = "0.0.0.0"; + local_s_portc = 501; + local_s_portd = 2152; + remote_s_portc = 500; + remote_s_portd = 2152; + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + E1_INTERFACE = + ( + { + type = "up"; + ipv4_cucp = {{ .CUCP_E1 }}; + ipv4_cuup = {{ .E1_IP }}; + } + ) + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "n3"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = {{ .N3_IP }}; + GNB_INTERFACE_NAME_FOR_NGU = "n3"; + GNB_IPV4_ADDRESS_FOR_NGU = {{ .N3_IP }}; + GNB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + + + log_config : + { + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="debug"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + f1ap_log_level ="info"; + ngap_log_level ="debug"; + }; +` + +const configurationTemplateSourceForDuO1Telnet = ` +Active_gNBs = ( "du-rfsim"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_DU_ID = 0xe00; + +# cell_type = "CELL_MACRO_GNB"; + + gNB_name = "du-rfsim"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = {{ .TAC }}; + plmn_list = ({ mcc = {{ .PLMN_MCC }}; mnc = {{ .PLMN_MNC }}; mnc_length = {{ .PLMN_MNC_LENGTH }}; snssaiList = ({ sst = {{ .NSSAI_SST }}, sd = 0x{{ .NSSAI_SD }} }) }); + + + nr_cellid = {{ .CELL_ID }}; + + ////////// Physical parameters: + + min_rxtxtime = 6; + // force_256qam_off = 1; + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = {{ .PHY_CELL_ID }}; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3410.4 MHz => 301 REs from PointA 25 PRBs + 1 RE + absoluteFrequencySSB = 630048; + dl_frequencyBand = {{ .DL_FREQ_BAND }}; + # this is 3410.4 - (51*12*30e-3/2) = 3401.22 MHz + dl_absoluteFrequencyPointA = 629436; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = {{ .DL_SCS }}; + dl_carrierBandwidth = {{ .DL_CARRIER_BW }}; + #initialDownlinkBWP + #genericParameters + # this is RBstart=0,L=50 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 13750; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 11; # this means shift of 14, so Coreset is in PRBs 1..48, SSB starts at PRB 15 + initialDLBWPsearchSpaceZero = 0; + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = {{ .UL_FREQ_BAND }}; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = {{ .UL_SCS }}; + ul_carrierBandwidth = {{ .UL_CARRIER_BW }}; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 13750; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 100; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 15; + preambleReceivedTargetPower = -104; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 3; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 15; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-96; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -96; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 5; + nrofDownlinkSlots = 2; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + } +); + +MACRLCs = ( + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "f1"; + local_n_if_name = "f1"; + local_n_address = {{ .F1C_DU_IP }}; + remote_n_address = {{ .F1C_CU_IP }}; + local_n_portc = 500; + local_n_portd = 2152; + remote_n_portc = 501; + remote_n_portd = 2152; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 200; + ulsch_max_frame_inactivity = 1; + } +); + +L1s = ( +{ + num_cc = 1; + tr_n_preference = "local_mac"; + prach_dtx_threshold = 200; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 +} +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 114; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + clock_src = "internal"; + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); +rfsimulator: { +serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs" +} + + log_config : + { + global_log_level ="info"; + hw_log_level ="info"; + phy_log_level ="info"; + mac_log_level ="info"; + rlc_log_level ="info"; + pdcp_log_level ="info"; + rrc_log_level ="info"; + f1ap_log_level ="info"; + ngap_log_level ="debug"; + }; +` diff --git a/test-infra/ReadMe.md b/test-infra/ReadMe.md new file mode 100644 index 0000000..51790aa --- /dev/null +++ b/test-infra/ReadMe.md @@ -0,0 +1,84 @@ +# Local Testing Environment for OAI with O1-Telnet +Follow the [Installation Guide](https://docs.nephio.org/docs/guides/install-guides/) to install Nephio + +Now, we need to follow the [following exercise](https://docs.nephio.org/docs/guides/user-guides/exercise-2-oai/) which we term as Master Excerises. + +### Step-1: Setting up infrastructure +Follow the steps 1 and 2 of [Master Excercise](https://docs.nephio.org/docs/guides/user-guides/exercise-2-oai/) + +### Step-2: Creating a Local operator-image and pushing it to Edge and Regional Cluster: +``` bash +# Clone the Repo +cd oai/ +docker build . -t local-ran-operator:v0.1 +kind load docker-image local-ran-operator:v0.1 -n edge +kind load docker-image local-ran-operator:v0.1 -n regional +``` + +### Step-3. Setting up Local Blueprint Repo: + 1. Create a new Repo at the Gitea-Cluster (172.18.0.200:3000) (Repo-name: 'oai-ran-bp' is recommended) + 2. Register the Repo to KPT + ``` bash + kpt alpha repo register \ + --namespace default \ + --repo-basic-username= \ + --repo-basic-password= \ + + ``` + 3. Create and push blueprints to local as per the [PR](https://github.com/nephio-project/catalog/pull/41) + ```bash + cd test-infra/local-bp/ + ./create-bp-package.sh + ``` + The above script will create the following blueprint packages with updated values: 'oai-ran-operator', 'pkg-example-cucp-bp', 'pkg-example-cuup-bp', 'pkg-example-du-bp'. + Make sure to check your repo, before moving forward. + +### Step-4: Making sure your PackageVariant point to your local Bp-Repo +```bash + cd test-infra/local-bp/packageVariants/ + cp -r . $HOME/test-infra/e2e/tests/oai/ +``` +Note: If your repo-name is not 'oai-ran-bp', then update the upstream-repo of packageVariant accordingly. + +### Step-5: Deploy Core and Ran +Follow the steps 3-6 of [Master Excercise](https://docs.nephio.org/docs/guides/user-guides/exercise-2-oai/) + +### Step-6: Validate the deployment by ascessing o1-telnet +```bash + sudo apt update && sudo apt install netcat + O1_IP=$(kubectl get svc oai-gnb-du-o1-telnet-lb -n oai-ran-du --context edge-admin@edge -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo o1 stats | nc -N $O1_IP 9090 +``` + +### Step-7: Deploy UE (20 MHz): +The current ue-image is not able to connect to the du using service (oai-gnb-du.oai-ran-du), Therefore, we provide the du-ip to ue manually as workaround: (Todo: Ideal way to resolve) +```bash +DU_POD=$(kubectl get pods -n oai-ran-du --context edge-admin@edge -l app.kubernetes.io/name=oai-gnb-du -o jsonpath='{.items[*].metadata.name}') +DU_IP=$(kubectl get pods $DU_POD -n oai-ran-du --context edge-admin@edge -o jsonpath="{.status.podIP}") +echo $DU_IP +``` +Copy the du-ip to the "uedeployment.yaml" under the Additional-Option "--rfsimulator.serveraddr" to both 20Mhz and 40Mhz UE. + +#### Deploy the ue +```bash +cd test-infra/oai-ue/ +kubectl apply -f namespace.yaml --context edge-admin@edge +kubectl apply -f 20Mhz/. --context edge-admin@edge +``` + +#### Run the Ping Test +```bash +UE_POD=$(kubectl get pods -n oai-ue --context edge-admin@edge -l app.kubernetes.io/name=oai-nr-ue -o jsonpath='{.items[*].metadata.name}') +UPF_POD=$(kubectl get pods -n oai-core --context=edge-admin@edge -l workload.nephio.org/oai=upf -o jsonpath='{.items[*].metadata.name}') +UPF_tun0_IP_ADDR=$(kubectl exec -it $UPF_POD -n oai-core -c upf-edge --context edge-admin@edge -- ip -f inet addr show tun0 | sed -En -e 's/.*inet ([0-9.]+).*/\1/p') +kubectl exec -it $UE_POD -n oai-ue --context edge-admin@edge -- ping -c 3 $UPF_tun0_IP_ADDR +``` +### Step-8: Bandwidth Reconfigure Procedure (20 Mhz to 40 Mhz) using o1-telnet +```bash +O1_IP=$(kubectl get svc oai-gnb-du-o1-telnet-lb -n oai-ran-du --context edge-admin@edge -o=jsonpath='{.status.loadBalancer.ingress[0].ip}') +echo o1 stop_modem | nc -N $O1_IP 9090 +echo o1 bwconfig 40 | nc -N $O1_IP 9090 +echo o1 start_modem | nc -N $O1_IP 9090 +echo o1 stats | nc -N $O1_IP 9090 +``` +After Reconfiguration, Connect the 40 Mhz ue using Step-7 and validate the Bandwidth-reconfiguration using Ping-Test diff --git a/test-infra/local-bp/create-bp-package.sh b/test-infra/local-bp/create-bp-package.sh new file mode 100644 index 0000000..2a31b5c --- /dev/null +++ b/test-infra/local-bp/create-bp-package.sh @@ -0,0 +1,29 @@ +REPO='oai-ran-bp' +echo "This script is only for testing" +mkdir temp +cd temp + +mkdir master +git clone https://github.com/jain-ashish-sam/catalog.git +mv catalog/workloads/oai/* master/ +rm -rf catalog +cp ../deployment.yaml master/oai-ran-operator/operator/ + +# for pkg in 'pkg-example-cucp-bp' 'pkg-example-cuup-bp' 'pkg-example-du-bp'; +for pkg in 'oai-ran-operator' 'pkg-example-cucp-bp' 'pkg-example-cuup-bp' 'pkg-example-du-bp'; +do + CREATED_PKG=$(kpt alpha rpkg init --repository=$REPO $pkg --workspace=v1 -ndefault| awk '{print $1;}') + kpt alpha rpkg pull $CREATED_PKG ./yourpkg -ndefault + cp -r master/$pkg/* yourpkg/ + echo "Editing Package $pkg is Done| Now Push-propose-Approve" + kpt alpha rpkg push $CREATED_PKG yourpkg -ndefault + kpt alpha rpkg propose $CREATED_PKG -ndefault + kpt alpha rpkg approve $CREATED_PKG -ndefault + rm -rf yourpkg +done + +cd .. +rm -rf temp +echo "Done| Check the content of your blueprint-repo once" + + diff --git a/test-infra/local-bp/deployment.yaml b/test-infra/local-bp/deployment.yaml new file mode 100644 index 0000000..f863527 --- /dev/null +++ b/test-infra/local-bp/deployment.yaml @@ -0,0 +1,34 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: oai-ran-operators + name: oai-ran-operator +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: oai-ran-operator + app.kubernetes.io/component: controller + template: + metadata: + name: oai-ran-operator + labels: + app.kubernetes.io/name: oai-ran-operator + app.kubernetes.io/component: controller + spec: + serviceAccountName: oai-ran-operator + containers: + - name: operator + image: docker.io/library/local-ran-operator:v0.1 + resources: + limits: + cpu: 500m + memory: 128Mi + requests: + cpu: 10m + memory: 64Mi + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL diff --git a/test-infra/local-bp/packageVariants/002-operators.yaml b/test-infra/local-bp/packageVariants/002-operators.yaml new file mode 100644 index 0000000..bd02d5f --- /dev/null +++ b/test-infra/local-bp/packageVariants/002-operators.yaml @@ -0,0 +1,79 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2023 The Nephio Authors. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-cp-operators +spec: + upstream: + repo: oai-core-packages + package: oai-cp-operators + revision: r2 + downstream: + repo: core + package: oai-cp-operators + annotations: + approval.nephio.org/policy: initial + injectors: + - name: core +--- +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-up-operators +spec: + upstream: + repo: oai-core-packages + package: oai-up-operators + revision: r2 + downstream: + repo: edge + package: oai-up-operators + annotations: + approval.nephio.org/policy: initial + injectors: + - name: edge + +--- +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-ran-operator-edge +spec: + upstream: + repo: oai-ran-bp + package: oai-ran-operator + revision: v1 + downstream: + repo: edge + package: oai-ran-operator + annotations: + approval.nephio.org/policy: initial + injectors: + - name: edge + +--- +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-ran-operator-regional +spec: + upstream: + repo: oai-ran-bp + package: oai-ran-operator + revision: v1 + downstream: + repo: regional + package: oai-ran-operator + annotations: + approval.nephio.org/policy: initial + injectors: + - name: regional diff --git a/test-infra/local-bp/packageVariants/004-ran-network.yaml b/test-infra/local-bp/packageVariants/004-ran-network.yaml new file mode 100644 index 0000000..a54a06c --- /dev/null +++ b/test-infra/local-bp/packageVariants/004-ran-network.yaml @@ -0,0 +1,61 @@ +--- +# SPDX-license-identifier: Apache-2.0 +############################################################################## +# Copyright (c) 2024 The Nephio Authors. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-cucp +spec: + upstream: + repo: oai-ran-bp + package: pkg-example-cucp-bp + revision: v1 + downstream: + repo: regional + package: oai-ran-cucp + annotations: + approval.nephio.org/policy: initial + injectors: + - name: regional +--- +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-du +spec: + upstream: + repo: oai-ran-bp + package: pkg-example-du-bp + revision: v1 + downstream: + repo: edge + package: oai-ran-du + annotations: + approval.nephio.org/policy: initial + injectors: + - name: edge +--- +apiVersion: config.porch.kpt.dev/v1alpha1 +kind: PackageVariant +metadata: + name: oai-cuup +spec: + upstream: + repo: oai-ran-bp + package: pkg-example-cuup-bp + revision: v1 + downstream: + repo: edge + package: oai-ran-cuup + annotations: + approval.nephio.org/policy: initial + injectors: + - name: edge + diff --git a/test-infra/oai-ue/20Mhz/configmap.yaml b/test-infra/oai-ue/20Mhz/configmap.yaml new file mode 100644 index 0000000..c6b85c9 --- /dev/null +++ b/test-infra/oai-ue/20Mhz/configmap.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: ConfigMap +metadata: # kpt-merge: oai-ue/oai-nr-ue-configmap + name: oai-nr-ue-configmap + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: '|ConfigMap|oai-ue|oai-nr-ue-configmap' +data: + nr-ue.conf: | + uicc0 = { + imsi = "001010000000100"; + key = "fec86ba6eb707ed08905757b1bb44b8f"; + opc= "C42449363BBAD02B66D16BC975D77CC1"; + dnn= "internet"; + nssai_sst=1; + nssai_sd=16777215; + } + + + \ No newline at end of file diff --git a/test-infra/oai-ue/20Mhz/sa.yaml b/test-infra/oai-ue/20Mhz/sa.yaml new file mode 100644 index 0000000..333a9a3 --- /dev/null +++ b/test-infra/oai-ue/20Mhz/sa.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: # kpt-merge: oai-ue/oai-nr-ue-sa + name: oai-nr-ue-sa + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: '|ServiceAccount|oai-ue|oai-nr-ue-sa' diff --git a/test-infra/oai-ue/20Mhz/uedeployment.yaml b/test-infra/oai-ue/20Mhz/uedeployment.yaml new file mode 100644 index 0000000..20718d3 --- /dev/null +++ b/test-infra/oai-ue/20Mhz/uedeployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: # kpt-merge: oai-ue/oai-nr-ue + name: oai-nr-ue + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: 'apps|Deployment|oai-ue|oai-nr-ue' +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: oai-nr-ue + app.kubernetes.io/instance: nrue + strategy: + type: Recreate + template: + metadata: + labels: + app.kubernetes.io/name: oai-nr-ue + app.kubernetes.io/instance: nrue + app: oai-nr-ue + spec: + securityContext: + runAsGroup: 0 + runAsUser: 0 + imagePullSecrets: + - name: regcred + containers: + - name: nr-ue + image: "oaisoftwarealliance/oai-nr-ue:v2.1.0" + securityContext: + privileged: true + env: + - name: USE_ADDITIONAL_OPTIONS + # oai-gnb-du.oai-ran-du + value: "--sa --rfsim --rfsimulator.serveraddr 192.168.1.21 --log_config.global_log_options level,nocolor,time -r 51 --numerology 1 -C 3450720000 --ssb 186 --uicc0.imsi 001010000000100" + volumeMounts: + - mountPath: /opt/oai-nr-ue/etc/nr-ue.conf + name: configuration + subPath: nr-ue.conf + dnsPolicy: ClusterFirst + restartPolicy: Always + serviceAccountName: oai-nr-ue-sa + terminationGracePeriodSeconds: 5 + volumes: + - configMap: + defaultMode: 420 + name: oai-nr-ue-configmap + name: configuration diff --git a/test-infra/oai-ue/40Mhz/configmap.yaml b/test-infra/oai-ue/40Mhz/configmap.yaml new file mode 100644 index 0000000..c6b85c9 --- /dev/null +++ b/test-infra/oai-ue/40Mhz/configmap.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: ConfigMap +metadata: # kpt-merge: oai-ue/oai-nr-ue-configmap + name: oai-nr-ue-configmap + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: '|ConfigMap|oai-ue|oai-nr-ue-configmap' +data: + nr-ue.conf: | + uicc0 = { + imsi = "001010000000100"; + key = "fec86ba6eb707ed08905757b1bb44b8f"; + opc= "C42449363BBAD02B66D16BC975D77CC1"; + dnn= "internet"; + nssai_sst=1; + nssai_sd=16777215; + } + + + \ No newline at end of file diff --git a/test-infra/oai-ue/40Mhz/sa.yaml b/test-infra/oai-ue/40Mhz/sa.yaml new file mode 100644 index 0000000..333a9a3 --- /dev/null +++ b/test-infra/oai-ue/40Mhz/sa.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: # kpt-merge: oai-ue/oai-nr-ue-sa + name: oai-nr-ue-sa + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: '|ServiceAccount|oai-ue|oai-nr-ue-sa' diff --git a/test-infra/oai-ue/40Mhz/uedeployment.yaml b/test-infra/oai-ue/40Mhz/uedeployment.yaml new file mode 100644 index 0000000..09f2522 --- /dev/null +++ b/test-infra/oai-ue/40Mhz/uedeployment.yaml @@ -0,0 +1,49 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: # kpt-merge: oai-ue/oai-nr-ue + name: oai-nr-ue + namespace: oai-ue + annotations: + internal.kpt.dev/upstream-identifier: 'apps|Deployment|oai-ue|oai-nr-ue' +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: oai-nr-ue + app.kubernetes.io/instance: nrue + strategy: + type: Recreate + template: + metadata: + labels: + app.kubernetes.io/name: oai-nr-ue + app.kubernetes.io/instance: nrue + app: oai-nr-ue + spec: + securityContext: + runAsGroup: 0 + runAsUser: 0 + imagePullSecrets: + - name: regcred + containers: + - name: nr-ue + image: "oaisoftwarealliance/oai-nr-ue:v2.1.0" + securityContext: + privileged: true + env: + - name: USE_ADDITIONAL_OPTIONS + # oai-gnb-du.oai-ran-du + value: "--sa -E --rfsimulator.serveraddr 192.168.1.21 --rfsim --log_config.global_log_options level,nocolor,time -r 106 --numerology 1 -C 3619200000 --uicc0.imsi 001010000000100 " + volumeMounts: + - mountPath: /opt/oai-nr-ue/etc/nr-ue.conf + name: configuration + subPath: nr-ue.conf + dnsPolicy: ClusterFirst + restartPolicy: Always + serviceAccountName: oai-nr-ue-sa + terminationGracePeriodSeconds: 5 + volumes: + - configMap: + defaultMode: 420 + name: oai-nr-ue-configmap + name: configuration diff --git a/test-infra/oai-ue/namespace.yaml b/test-infra/oai-ue/namespace.yaml new file mode 100644 index 0000000..d478d5a --- /dev/null +++ b/test-infra/oai-ue/namespace.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: Namespace +metadata: # kpt-merge: /oai-ue + name: oai-ue + labels: + pod-security.kubernetes.io/warn: "privileged" + pod-security.kubernetes.io/audit: "privileged" + pod-security.kubernetes.io/enforce: "privileged" + annotations: + internal.kpt.dev/upstream-identifier: '|Namespace|default|oai-ue'