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