# Copyright (c) 2018 Intel Corporation
#
# 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.
---
schema: yardstick:task:0.1
scenarios:
- type: NSPerf
  traffic_profile: ../../traffic_profiles/pktgen_throughput.yaml
  topology: cmts-tg-topology.yaml
  nodes:
    tg__0: trafficgen-k8syardstick
    vnf__0: vnf-k8syardstick
  options: {}
  runner:
    type: IterationIPC
    iterations: 10
    interval: 15
    timeout: 10000
context:
  name: k8syardstick
  type: Kubernetes

  servers:
    vnf:
      containers:
        - image: si-docker.ir.intel.com/vcmts-ubuntu/vcmts-pktgen-uepi
          args: ["/opt/bin/cmk isolate --conf-dir=/etc/cmk --socket-id=0 --pool=dataplane /vcmts/setup.sh anga_mac_1_ds.pcap ds"]
          env:
            - name: LUA_PATH
              value: "/vcmts/Pktgen.lua"
            - name: CMK_PROC_FS
              value: "/host/proc"
          resources:
            requests:
              pod.alpha.kubernetes.io/opaque-int-resource-cmk: "1"
          ports:
            - containerPort: 22022
          volumeMounts:
            - name: hugepages
              mountPath: /dev/hugepages
            - name: sysfs
              mountPath: /sys
            - name: sriov
              mountPath: /sriov-cni
            - name: host-proc
              mountPath: /host/proc
              readOnly: true
            - name: cmk-install-dir
              mountPath: /opt/bin
            - name: cmk-conf-dir
              mountPath: /etc/cmk
          securityContext:
            allowPrivilegeEscalation: true
            privileged: true

      node_ports:
        - name: lua  # Lower case alphanumeric characters or '-'
          port: 22022
      networks:
        - flannel
        - sriov01
      volumes:
        - name: hugepages
          hostPath:
            path: /dev/hugepages
        - name: sysfs
          hostPath:
            path: /sys
        - name: sriov
          hostPath:
            path: /var/lib/cni/sriov
        - name: cmk-install-dir
          hostPath:
            path: /opt/bin
        - name: host-proc
          hostPath:
            path: /proc
        - name: cmk-conf-dir
          hostPath:
            path: /etc/cmk

    trafficgen:
      containers:
        - image: si-docker.ir.intel.com/vcmts-ubuntu/vcmts-pktgen-uepi
          args: ["/opt/bin/cmk isolate --conf-dir=/etc/cmk --socket-id=0 --pool=dataplane /vcmts/setup.sh anga_mac_1_ds.pcap ds"]
          env:
            - name: LUA_PATH
              value: "/vcmts/Pktgen.lua"
            - name: CMK_PROC_FS
              value: "/host/proc"
          resources:
            requests:
              pod.alpha.kubernetes.io/opaque-int-resource-cmk: "1"
          ports:
            - containerPort: 22022
          volumeMounts:
            - name: hugepages
              mountPath: /dev/hugepages
            - name: sysfs
              mountPath: /sys
            - name: sriov
              mountPath: /sriov-cni
            - name: host-proc
              mountPath: /host/proc
              readOnly: true
            - name: cmk-install-dir
              mountPath: /opt/bin
            - name: cmk-conf-dir
              mountPath: /etc/cmk
          securityContext:
            allowPrivilegeEscalation: true
            privileged: true

      node_ports:
        - name: lua  # Lower case alphanumeric characters or '-'
          port: 22022
      networks:
        - flannel
        - sriov01
      volumes:
        - name: hugepages
          hostPath:
            path: /dev/hugepages
        - name: sysfs
          hostPath:
            path: /sys
        - name: sriov
          hostPath:
            path: /var/lib/cni/sriov
        - name: cmk-install-dir
          hostPath:
            path: /opt/bin
        - name: host-proc
          hostPath:
            path: /proc
        - name: cmk-conf-dir
          hostPath:
            path: /etc/cmk

  networks:
    flannel:
      args: '[{ "delegate": { "isDefaultGateway": true }}]'
      plugin: flannel
    sriov01:
      plugin: sriov
      args: '[{"if0": "ens802f0",
               "if0name": "net0",
               "dpdk": {
                   "kernel_driver": "i40evf",
                   "dpdk_driver": "igb_uio",
                   "dpdk_tool": "/opt/nsb_bin/dpdk-devbind.py"}
             }]'
    sriov02:
      plugin: sriov
      args: '[{"if0": "ens802f0",
               "if0name": "net0",
               "dpdk": {
                   "kernel_driver": "i40evf",
                   "dpdk_driver": "igb_uio",
                   "dpdk_tool": "/opt/nsb_bin/dpdk-devbind.py"}
             }]'