Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 1 | --- |
Wei-Yu Chen | 53aec36 | 2019-01-18 16:30:33 -0800 | [diff] [blame^] | 2 | # Copyright 2018-present Open Networking Foundation |
| 3 | # Copyright 2018 Intel Corporation |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | apiVersion: v1 |
| 18 | kind: ConfigMap |
| 19 | metadata: |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 20 | name: ngicdp-config |
| 21 | data: |
| 22 | adc_rules.cfg: | |
| 23 | [GLOBAL] |
| 24 | NUM_ADC_RULES = 5 |
| 25 | |
| 26 | ;FORMAT :: |
| 27 | ;ADC_TYPE : [ DOMAIN = 0 | IP = 1 | IP PREFIX =2 ] |
| 28 | ; |
| 29 | ;if ADC_TYPE = 0 |
| 30 | ; DOMAIN |
| 31 | ;elseif ADC_TYPE = 1 |
| 32 | ; IP |
| 33 | ;elseif ADC_TYPE = 2 |
| 34 | ; IP |
| 35 | ; PREFIX |
| 36 | ;else |
| 37 | ; NONE |
| 38 | ; |
| 39 | ;NOTE : |
| 40 | ;Rules defined first have a higher priority, unless DROP is specified |
| 41 | ;(i.e. multiple rules for the same IP). |
| 42 | ;When specifying DROP with an IP address, use a prefix of 32 to prevent DNS |
| 43 | ;results from overwriting rule. |
| 44 | |
| 45 | |
| 46 | [ADC_RULE_1] |
| 47 | ADC_TYPE = 2 |
| 48 | IP = 0.0.0.0 |
| 49 | PREFIX = 0 |
| 50 | |
| 51 | [ADC_RULE_2] |
| 52 | ADC_TYPE = 2 |
| 53 | IP = 13.1.1.0 |
| 54 | PREFIX = 24 |
| 55 | |
| 56 | [ADC_RULE_3] |
| 57 | ADC_TYPE = 1 |
| 58 | IP = 13.1.1.254 |
| 59 | |
| 60 | [ADC_RULE_4] |
| 61 | ADC_TYPE = 0 |
| 62 | DOMAIN = www.example.gov |
| 63 | |
| 64 | [ADC_RULE_5] |
| 65 | ADC_TYPE = 0 |
| 66 | DOMAIN = www.drop_example.com |
| 67 | cdr.cfg: | |
| 68 | CDR_PATH=./cdr |
| 69 | MASTER_CDR=./cdr/master.csv |
| 70 | cp_config.cfg: | |
| 71 | if [ ! -d "/dev/hugepages" ]; then |
| 72 | MEMORY="--no-huge -m $((MEM_LIMIT-1024))" |
| 73 | fi |
| 74 | |
| 75 | SGW_S1U_IP=$(netstat -ie | grep -A1 s1u-net | tail -1 | awk '{print $2}' | tr -d addr:) |
| 76 | SHARED_DIR="/opt/ngic/config/shared" |
| 77 | if [ -d ${SHARED_DIR} ]; then |
| 78 | while [ ! -f ${SHARED_DIR}/SGW_S1U_IP ]; do echo "Waiting for SGW_S1U_IP"; sleep 2; done |
| 79 | SGW_S1U_IP=$(cat ${SHARED_DIR}/SGW_S1U_IP) |
| 80 | fi |
| 81 | |
| 82 | SGW_S11_IP=$(hostname) |
| 83 | MGMT_INFO="-s ${SGW_S11_IP} -m ${MME_S11_IP} -w ${SGW_S1U_IP}" |
| 84 | APN_INFO="-i ${IP_POOL_IP} -p ${IP_POOL_MASK} -a ${APN}" |
| 85 | SPGW_CFG="-d 03 -l 2 -r 7.7.7.7 -g 6.6.6.6 -v 4.4.4.4 -u 5.5.5.5" |
| 86 | |
| 87 | TEID_INFO="-t ${S11_TEID_POOL_START} -e ${S11_TEID_POOL_STOP} -q ${S1U_TEID_POOL_START} -o ${S1U_TEID_POOL_STOP}" |
| 88 | APP_ARGS="${MGMT_INFO} ${APN_INFO} ${SPGW_CFG} ${TEID_INFO}" |
| 89 | |
| 90 | CORES="-c $(taskset -p $$ | awk '{print $NF}')" |
| 91 | DEVICES="--no-pci" |
| 92 | EAL_ARGS="${CORES} ${MEMORY} ${DEVICES}" |
| 93 | dp_config.cfg: | |
| 94 | get_pcimac_addr () { |
| 95 | ifname=$1 |
| 96 | cid="$(sed -ne '/hostname/p' /proc/1/task/1/mountinfo | awk -F '/' '{print $6}' |tr -d " " )" |
| 97 | cid="$cid-$ifname" |
| 98 | eval "export $2=$(awk -F '"' '{print $4}' /sriov-cni/$cid)" |
| 99 | eval "export $3=$(awk -F '"' '{print $8}' /sriov-cni/$cid)" |
| 100 | eval "export $4=$(awk -F '"' '{print $12}' /sriov-cni/$cid)" |
| 101 | } |
| 102 | |
| 103 | if [ -d "/sriov-cni" ]; then |
| 104 | echo "================== SR-IOV FOUND ============" |
| 105 | get_pcimac_addr s1u-net SGW_S1U_PCI S1U_MAC SGW_S1U_IP |
| 106 | get_pcimac_addr sgi-net SGW_SGI_PCI SGI_MAC SGW_SGI_IP |
| 107 | DEVICES="-w $SGW_S1U_PCI -w $SGW_SGI_PCI" |
| 108 | SHARED_DIR="/opt/ngic/config/shared" |
| 109 | echo $SGW_S1U_IP > ${SHARED_DIR}/SGW_S1U_IP |
| 110 | else #dev --vdev af_packt |
| 111 | echo "vdev (AF_PACKET)" |
| 112 | # set the variables we provide |
| 113 | SGW_S1U_IP=$(netstat -ie | grep -A1 s1u-net | tail -1 | awk '{print $2}' | tr -d addr:) |
| 114 | SGW_SGI_IP=$(netstat -ie | grep -A1 sgi-net | tail -1 | awk '{print $2}' | tr -d addr:) |
| 115 | S1U_MAC=$( netstat -ie | grep -B1 $SGW_S1U_IP | head -n1 | awk '{print $5}' ) |
| 116 | SGI_MAC=$( netstat -ie | grep -B1 $SGW_SGI_IP | head -n1 | awk '{print $5}' ) |
| 117 | |
| 118 | DEVICES="--no-pci --vdev eth_af_packet0,iface=s1u-net --vdev eth_af_packet1,iface=sgi-net" |
| 119 | fi |
| 120 | |
| 121 | if [ ! -d "/dev/hugepages" ]; then |
| 122 | MEMORY="--no-huge -m $((MEM_LIMIT-1024))" |
| 123 | fi |
| 124 | |
| 125 | CORES="-c $(taskset -p $$ | awk '{print $NF}')" |
| 126 | SPGW_CFG="--spgw_cfg 03" |
| 127 | EAL_ARGS="${CORES} ${MEMORY} ${DEVICES}" |
| 128 | |
| 129 | S1U="--s1u_ip ${SGW_S1U_IP} --s1u_mac ${S1U_MAC}" |
| 130 | SGI="--sgi_ip ${SGW_SGI_IP} --sgi_mac ${SGI_MAC} --sgi_gw_ip ${RTR_SGI_IP} --sgi_mask ${SGI_MASK}" |
| 131 | WORKERS="--num_workers 1" |
| 132 | MISC="--log 1" |
| 133 | APP_ARGS="${S1U} ${SGI} ${WORKERS} ${MISC} ${SPGW_CFG}" |
| 134 | interface.cfg: | |
| 135 | [0] |
| 136 | dp_comm_ip = 127.0.0.1 |
| 137 | dp_comm_port = 20 |
Wei-Yu Chen | b3409b8 | 2019-01-17 15:34:23 -0800 | [diff] [blame] | 138 | cp_comm_ip = {{ .Values.controlplane_hostname }} |
| 139 | cp_comm_port = {{ .Values.controlplane_port }} |
Wei-Yu Chen | 450a98a | 2019-01-15 16:56:30 -0800 | [diff] [blame] | 140 | meter_profile.cfg: | |
| 141 | [GLOBAL] |
| 142 | NUM_OF_IDX = 7 |
| 143 | |
| 144 | [ENTRY_1] |
| 145 | ;Committed Information Rate (CIR). Measured in bytes per second. |
| 146 | ;MBR is mapped into CIR, convert MBR from bits to Bytes and set CIR. |
| 147 | CIR = 2342400 |
| 148 | ;Committed Burst Size unit = Bytes |
| 149 | CBS = 5856 |
| 150 | ;Excess Burst Size unit = Bytes |
| 151 | EBS = 11712 |
| 152 | ;Meter profile index. Refer this index in static_pcc.cfg to set AMBR/MBR |
| 153 | MTR_PROFILE_IDX = 3 |
| 154 | |
| 155 | [ENTRY_2] |
| 156 | ;1200 = 1756800 |
| 157 | ;1400 = 2049600 |
| 158 | ;1600 = 2342400 |
| 159 | CIR = 2342400 |
| 160 | CBS = 5856 |
| 161 | EBS = 11712 |
| 162 | MTR_PROFILE_IDX = 4 |
| 163 | |
| 164 | [ENTRY_3] |
| 165 | ; QCI5,QCI7 15.571kbps = 1947 B |
| 166 | CIR = 2342400 |
| 167 | CBS = 5856 |
| 168 | EBS = 11712 |
| 169 | MTR_PROFILE_IDX = 5 |
| 170 | |
| 171 | [ENTRY_4] |
| 172 | ; QCI1, 44kbps = 5500 B |
| 173 | CIR = 2342400 |
| 174 | CBS = 5856 |
| 175 | EBS = 11712 |
| 176 | MTR_PROFILE_IDX = 6 |
| 177 | |
| 178 | [ENTRY_5] |
| 179 | ; QCI9, 31.143kbps = 3893 B |
| 180 | CIR = 2342400 |
| 181 | CBS = 5856 |
| 182 | EBS = 11712 |
| 183 | MTR_PROFILE_IDX = 7 |
| 184 | |
| 185 | [ENTRY_6] |
| 186 | ; 128B, 7pps |
| 187 | CIR = 2342400 |
| 188 | CBS = 512 |
| 189 | EBS = 1024 |
| 190 | MTR_PROFILE_IDX = 8 |
| 191 | |
| 192 | [ENTRY_7] |
| 193 | ; 128B, 2pps |
| 194 | CIR = 2342400 |
| 195 | CBS = 512 |
| 196 | EBS = 1024 |
| 197 | MTR_PROFILE_IDX = 9 |
| 198 | |
| 199 | pcc_rules.cfg: | |
| 200 | [GLOBAL] |
| 201 | NUM_PCC_FILTERS = 9 |
| 202 | ;To config AMBR/MBR values refer meter_profile.cfg. specify only the |
| 203 | ;meter profile index to be set here. |
| 204 | UL_AMBR_MTR_PROFILE_IDX = 3 |
| 205 | DL_AMBR_MTR_PROFILE_IDX = 4 |
| 206 | |
| 207 | ;default filter - must be first for now (until DP doesn't install any filters) |
| 208 | ;associated with default adc rule |
| 209 | [PCC_FILTER_1] |
| 210 | RULE_NAME = DefaultRule |
| 211 | RATING_GROUP = 9 |
| 212 | SERVICE_ID = 0 |
| 213 | RULE_STATUS = 0 |
| 214 | GATE_STATUS = 1 |
| 215 | SESSION_CONT = 0 |
| 216 | REPORT_LEVEL = 1 |
| 217 | CHARGING_MODE = 0 |
| 218 | METERING_METHOD = 0 |
| 219 | MUTE_NOTIFY = 0 |
| 220 | MONITORING_KEY = 0 |
| 221 | SPONSOR_ID = 0 |
| 222 | REDIRECT_INFO = 0 |
| 223 | PRECEDENCE = 254 |
| 224 | DROP_PKT_COUNT = 0 |
| 225 | ;Specify the meter profile index from meter_profile.cfg |
| 226 | UL_MBR_MTR_PROFILE_IDX = 7 |
| 227 | DL_MBR_MTR_PROFILE_IDX = 7 |
| 228 | ;List of ADC filter indices |
| 229 | SDF_FILTER_IDX = 99998 |
| 230 | |
| 231 | [PCC_FILTER_2] |
| 232 | RULE_NAME = sdf_rule_1 |
| 233 | RATING_GROUP = 5 |
| 234 | SERVICE_ID = 0 |
| 235 | RULE_STATUS = 0 |
| 236 | GATE_STATUS = 1 |
| 237 | SESSION_CONT = 0 |
| 238 | REPORT_LEVEL = 2 |
| 239 | CHARGING_MODE = 0 |
| 240 | METERING_METHOD = 0 |
| 241 | MUTE_NOTIFY = 0 |
| 242 | MONITORING_KEY = 0 |
| 243 | SPONSOR_ID = 0 |
| 244 | REDIRECT_INFO = 0 |
| 245 | PRECEDENCE = 1 |
| 246 | DROP_PKT_COUNT = 0 |
| 247 | UL_MBR_MTR_PROFILE_IDX = 5 |
| 248 | DL_MBR_MTR_PROFILE_IDX = 5 |
| 249 | ;List of SDF filter indices |
| 250 | SDF_FILTER_IDX = 1 |
| 251 | |
| 252 | [PCC_FILTER_3] |
| 253 | RULE_NAME = sdf_rule_2 |
| 254 | RATING_GROUP = 1 |
| 255 | SERVICE_ID = 0 |
| 256 | RULE_STATUS = 0 |
| 257 | GATE_STATUS = 1 |
| 258 | SESSION_CONT = 0 |
| 259 | REPORT_LEVEL = 3 |
| 260 | CHARGING_MODE = 0 |
| 261 | METERING_METHOD = 0 |
| 262 | MUTE_NOTIFY = 0 |
| 263 | MONITORING_KEY = 0 |
| 264 | SPONSOR_ID = 0 |
| 265 | REDIRECT_INFO = 0 |
| 266 | PRECEDENCE = 18 |
| 267 | DROP_PKT_COUNT = 0 |
| 268 | UL_MBR_MTR_PROFILE_IDX = 6 |
| 269 | DL_MBR_MTR_PROFILE_IDX = 6 |
| 270 | ;List of SDF filter indices |
| 271 | SDF_FILTER_IDX = 2 |
| 272 | |
| 273 | [PCC_FILTER_4] |
| 274 | RULE_NAME = adc_rule_1 |
| 275 | RATING_GROUP = Zero-Rate |
| 276 | SERVICE_ID = Internet |
| 277 | RULE_STATUS = 0 |
| 278 | GATE_STATUS = 1 |
| 279 | SESSION_CONT = 0 |
| 280 | REPORT_LEVEL = 8 |
| 281 | CHARGING_MODE = 0 |
| 282 | METERING_METHOD = 0 |
| 283 | MUTE_NOTIFY = 0 |
| 284 | MONITORING_KEY = 0 |
| 285 | REDIRECT_INFO = 0 |
| 286 | SPONSOR_ID = Example |
| 287 | PRECEDENCE = 15 |
| 288 | DROP_PKT_COUNT = 0 |
| 289 | UL_MBR_MTR_PROFILE_IDX = 7 |
| 290 | DL_MBR_MTR_PROFILE_IDX = 7 |
| 291 | ;List of SDF filter indices |
| 292 | ADC_FILTER_IDX = 1 |
| 293 | |
| 294 | [PCC_FILTER_5] |
| 295 | RULE_NAME = adc_rule_2 |
| 296 | RATING_GROUP = 0 |
| 297 | SERVICE_ID = CIPA |
| 298 | RULE_STATUS = 0 |
| 299 | GATE_STATUS = 1 |
| 300 | SESSION_CONT = 0 |
| 301 | REPORT_LEVEL = 9 |
| 302 | CHARGING_MODE = 0 |
| 303 | METERING_METHOD = 0 |
| 304 | MUTE_NOTIFY = 0 |
| 305 | MONITORING_KEY = 0 |
| 306 | SPONSOR_ID = Example |
| 307 | REDIRECT_INFO = 0 |
| 308 | SPONSOR_ID = Example |
| 309 | REDIRECT_INFO = 0 |
| 310 | PRECEDENCE = 4 |
| 311 | DROP_PKT_COUNT = 0 |
| 312 | UL_MBR_MTR_PROFILE_IDX = 0 |
| 313 | DL_MBR_MTR_PROFILE_IDX = 0 |
| 314 | ;List of SDF filter indices |
| 315 | ADC_FILTER_IDX = 2 |
| 316 | |
| 317 | [PCC_FILTER_6] |
| 318 | RULE_NAME = sdf_rule_3 |
| 319 | RATING_GROUP = 7 |
| 320 | SERVICE_ID = 0 |
| 321 | RULE_STATUS = 0 |
| 322 | GATE_STATUS = 1 |
| 323 | SESSION_CONT = 0 |
| 324 | REPORT_LEVEL = 4 |
| 325 | CHARGING_MODE = 0 |
| 326 | METERING_METHOD = 0 |
| 327 | MUTE_NOTIFY = 0 |
| 328 | MONITORING_KEY = 0 |
| 329 | SPONSOR_ID = 0 |
| 330 | REDIRECT_INFO = 0 |
| 331 | PRECEDENCE = 17 |
| 332 | DROP_PKT_COUNT = 0 |
| 333 | UL_MBR_MTR_PROFILE_IDX = 5 |
| 334 | DL_MBR_MTR_PROFILE_IDX = 5 |
| 335 | ;List of SDF filter indices |
| 336 | SDF_FILTER_IDX = 3 |
| 337 | |
| 338 | [PCC_FILTER_7] |
| 339 | RULE_NAME = adc_rule_3 |
| 340 | RATING_GROUP = Zero-Rate |
| 341 | SERVICE_ID = Internet |
| 342 | RULE_STATUS = 0 |
| 343 | GATE_STATUS = 1 |
| 344 | SESSION_CONT = 0 |
| 345 | REPORT_LEVEL = 5 |
| 346 | CHARGING_MODE = 0 |
| 347 | METERING_METHOD = 0 |
| 348 | MUTE_NOTIFY = 0 |
| 349 | MONITORING_KEY = 0 |
| 350 | SPONSOR_ID = Example |
| 351 | REDIRECT_INFO = 0 |
| 352 | PRECEDENCE = 210 |
| 353 | DROP_PKT_COUNT = 0 |
| 354 | UL_MBR_MTR_PROFILE_IDX = 7 |
| 355 | DL_MBR_MTR_PROFILE_IDX = 7 |
| 356 | ;List of SDF filter indices |
| 357 | ADC_FILTER_IDX = 4 |
| 358 | |
| 359 | [PCC_FILTER_8] |
| 360 | RULE_NAME = adc_rule_4 |
| 361 | RATING_GROUP = Zero-Rate |
| 362 | SERVICE_ID = Management |
| 363 | RULE_STATUS = 0 |
| 364 | GATE_STATUS = 1 |
| 365 | SESSION_CONT = 0 |
| 366 | REPORT_LEVEL = 6 |
| 367 | CHARGING_MODE = 0 |
| 368 | METERING_METHOD = 0 |
| 369 | MUTE_NOTIFY = 0 |
| 370 | MONITORING_KEY = 0 |
| 371 | SPONSOR_ID = Example |
| 372 | REDIRECT_INFO = 0 |
| 373 | PRECEDENCE = 200 |
| 374 | DROP_PKT_COUNT = 0 |
| 375 | UL_MBR_MTR_PROFILE_IDX = 7 |
| 376 | DL_MBR_MTR_PROFILE_IDX = 7 |
| 377 | ;List of SDF filter indices |
| 378 | ADC_FILTER_IDX = 12 |
| 379 | |
| 380 | [PCC_FILTER_9] |
| 381 | RULE_NAME = adc_rule_5 |
| 382 | RATING_GROUP = Zero-Rate |
| 383 | SERVICE_ID = Provisioning |
| 384 | RULE_STATUS = 0 |
| 385 | GATE_STATUS = 1 |
| 386 | SESSION_CONT = 0 |
| 387 | REPORT_LEVEL = 7 |
| 388 | CHARGING_MODE = 0 |
| 389 | METERING_METHOD = 0 |
| 390 | MUTE_NOTIFY = 0 |
| 391 | MONITORING_KEY = 0 |
| 392 | SPONSOR_ID = Example |
| 393 | REDIRECT_INFO = 0 |
| 394 | PRECEDENCE = 220 |
| 395 | DROP_PKT_COUNT = 0 |
| 396 | UL_MBR_MTR_PROFILE_IDX = 7 |
| 397 | DL_MBR_MTR_PROFILE_IDX = 7 |
| 398 | ;List of SDF filter indices |
| 399 | ADC_FILTER_IDX = 3 |
| 400 | sdf_rules.cfg: | |
| 401 | [GLOBAL] |
| 402 | NUM_SDF_FILTERS = 4 |
| 403 | |
| 404 | [SDF_FILTER_1] |
| 405 | DIRECTION = downlink_only |
| 406 | IPV4_REMOTE = 13.2.1.113 |
| 407 | IPV4_REMOTE_MASK = 255.255.255.0 |
| 408 | PROTOCOL = 17 |
| 409 | LOCAL_LOW_LIMIT_PORT = 0 |
| 410 | LOCAL_HIGH_LIMIT_PORT = 65535 |
| 411 | REMOTE_LOW_LIMIT_PORT = 0 |
| 412 | REMOTE_HIGH_LIMIT_PORT = 65535 |
| 413 | |
| 414 | [SDF_FILTER_2] |
| 415 | DIRECTION = uplink_only |
| 416 | IPV4_LOCAL = 16.255.255.0 |
| 417 | IPV4_LOCAL_MASK = 255.255.255.0 |
| 418 | PROTOCOL = 17 |
| 419 | LOCAL_LOW_LIMIT_PORT = 0 |
| 420 | LOCAL_HIGH_LIMIT_PORT = 65535 |
| 421 | REMOTE_LOW_LIMIT_PORT = 0 |
| 422 | REMOTE_HIGH_LIMIT_PORT = 65535 |
| 423 | |
| 424 | [SDF_FILTER_3] |
| 425 | DIRECTION = downlink_only |
| 426 | IPV4_REMOTE = 130.10.0.0 |
| 427 | IPV4_REMOTE_MASK = 255.255.0.0 |
| 428 | PROTOCOL = 17 |
| 429 | REMOTE_LOW_LIMIT_PORT = 5060 |
| 430 | REMOTE_HIGH_LIMIT_PORT = 5060 |
| 431 | |
| 432 | [SDF_FILTER_4] |
| 433 | DIRECTION = uplink_only |
| 434 | IPV4_REMOTE = 103.1.0.0 |
| 435 | IPV4_REMOTE_MASK = 255.255.0.0 |
| 436 | PROTOCOL = 17 |
| 437 | LOCAL_LOW_LIMIT_PORT = 17000 |
| 438 | LOCAL_HIGH_LIMIT_PORT = 17010 |
| 439 | |