Adding a dev-values.yaml for a mininet based deloyment (stratum-bmv2) also modifying some resource constraints

Change-Id: I228d536ae9d3c0033f96eb4d16c90415d9a188ea
diff --git a/.gitignore b/.gitignore
index 2b8eb93..6f01124 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 # SPDX-License-Identifier: Apache-2.0
 Chart.lock
 charts
+.idea/
diff --git a/VERSION b/VERSION
index 45a1b3f..26aaba0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-1.1.2
+1.2.0
diff --git a/configs/3-node-cfg.yaml b/configs/3-node-cfg.yaml
new file mode 100644
index 0000000..07915ea
--- /dev/null
+++ b/configs/3-node-cfg.yaml
@@ -0,0 +1,22 @@
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+# Port Mappings are for the ONOS REST, CLI and UI,
+kind: Cluster
+apiVersion: kind.x-k8s.io/v1alpha4
+nodes:
+  - role: worker
+  - role: worker
+  - role: control-plane
+    kubeadmConfigPatches:
+      - |
+        kind: InitConfiguration
+        nodeRegistration:
+          kubeletExtraArgs:
+            node-labels: "ingress-ready=true"
+    extraPortMappings:
+      - containerPort: 30115
+        hostPort: 30115
+      - containerPort: 30120
+        hostPort: 30120
\ No newline at end of file
diff --git a/sdfabric/Chart.yaml b/sdfabric/Chart.yaml
index c02128c..10c2c84 100644
--- a/sdfabric/Chart.yaml
+++ b/sdfabric/Chart.yaml
@@ -7,7 +7,7 @@
 description: A chart to deploy all SD-Fabric components
 kubeVersion: ">=1.18.0"
 type: application
-version: 1.1.2
+version: 1.2.0
 keywords:
   - aether
   - sdn
diff --git a/sdfabric/README.md b/sdfabric/README.md
index c6ac1ad..dfca10d 100644
--- a/sdfabric/README.md
+++ b/sdfabric/README.md
@@ -8,24 +8,14 @@
 
 ## Prerequisites
 
-There are several preparation work that need to be done before deploying SD-Fabric.
-1. All switches have been provisioned with Docker and Kubernetes
-2. All switches have been configured as special Kubernetes nodes
-3. Prepare ONOS network config
-4. Prepare Stratum chassis config for each switch
-
-Please refer to step 1 to 4 in [SD-Fabric deployment guide](https://docs.sd-fabric.org/master/deployment.html)
-for prerequisites, and come back here for the rest of the installation instructions.
-
-## Installation
-
-Here are steps to deploy the sdfabric helm chart:
+Here are steps to download the sdfabric helm chart:
 
 1. **Clone SD-Fabric Helm chart**
 
     ```bash
+    cd $HOME/
     git clone ssh://gerrit.opencord.org:29418/sdfabric-helm-charts
-    cd sdfabric-helm-charts/sdfabric
+    cd $HOME/sdfabric-helm-charts/sdfabric
     ```
 
 2. **Update Helm dependencies**
@@ -34,7 +24,115 @@
     helm dep update
     ```
 
-3. **Prepare your Helm value**
+## Fully virtual Installation 
+
+This section allows you to deploy a fully virtual system with Kind, Mininet and ONOS on you devlopment machine. 
+The topology is a custom 2x2 leaf spine topology, defined in mininet in the 
+[topo-leafspine.py](https://github.com/opencord/helm-charts/blob/master/mininet/toposcripts/topo-leafspine.py) and described 
+in ONOS in the `dev-values.yaml` `netcfg` section. 
+
+**Note** This section is based on docker and kind, please ensure to have both installed in your environment.
+Also ensure to give enough resources to your docker env. A suggestion is 16GB of ram, 12 cores, 2 GB of swap.
+
+### Mininet and Fabric Deployment
+
+1. **Download the mininet helm charts**
+
+   ```bash
+   cd cd $HOME/
+   git clone https://gerrit.opencord.org/helm-charts
+   cd $HOME/helm-charts/mininet
+   ```
+
+2. **Update Helm dependencies**
+
+    ```bash
+    helm dep update
+    ```
+
+3. **Deploy a kind cluster**
+
+   ```bash
+   cd $HOME/sdfabric-helm-charts/sdfabric
+   kind create cluster --config $HOME/sdfabric-helm-charts/configs/3-node-cfg.yaml
+   kubectl taint nodes --all node-role.kubernetes.io/master-
+   ```
+
+4. **Deploy Mininet**
+   
+   ```bash
+   cd $HOME/helm-charts/mininet
+   helm install -n sdfabric --create-namespace -f sdfabric-values.yaml mininet .
+   ```
+   
+5. **Deploy Sd-Fabric**
+
+   ```bash
+   cd $HOME/sdfabric-helm-charts/sdfabric
+   helm install -n sdfabric --create-namespace -f dev-values.yaml sdfabric .
+   ```
+
+6. **Verify the installation**
+    ```bash
+    helm -n sdfabric ls
+    ```
+
+7.  **Uninstall**
+    ```bash
+    helm -n sdfabric delete sdfabric
+    helm -n sdfabric delete mininet
+    ```
+### Useful Commands
+
+Attach to Mininet
+
+   ```bash
+   kubectl attach -it -n sdfabric <mininet pod name> 
+   ```
+   Example of pod name: mininet-578d9575d4-xdtb2
+
+SSH into ONOS
+   Pick the instance you prefer (if you deployed more than 1)
+   ```bash
+   kubectl -n sdfabric exec -it sdfabric-onos-classic-0 -- bash /root/onos/apache-karaf-4.2.14/bin/client
+   kubectl -n sdfabric exec -it sdfabric-onos-classic-1 -- bash /root/onos/apache-karaf-4.2.14/bin/client
+   kubectl -n sdfabric exec -it sdfabric-onos-classic-2 -- bash /root/onos/apache-karaf-4.2.14/bin/client
+   ```
+
+### Parameters
+
+If you'd like to modify the number of ONOS instances and Atomix (1 and 1 by default), you can do so by changing the
+parameters in the `dev-values.yaml` file.
+
+`onos-classic.atomix.replicas` for Atomix.
+
+`onos-classic.replicas` for ONOS.
+
+If you want to change the topology entirely:
+
+- please write a new `topo.py` file in the `mininet` helm chart 
+- specify it as a parameter it in the `sd-fabric-values.yaml` file under `topoScript`. 
+- write a new `netcfg` for ONOS based on the new `topo.py` file
+- Insert it under `onos-classic.netcfg` in `netcfg-leafspine.yaml` in the sdfabric helm chart. 
+
+## Hardware Installation
+
+### Prerequisites
+
+There are several preparation work that need to be done before deploying SD-Fabric.
+1. All switches have been provisioned with Docker and Kubernetes
+2. All switches have been configured with SD-Fabric specific taints and labels
+3. Prepare ONOS network config
+4. Prepare Stratum chassis config for each switch
+
+These steps assume you have already deployed a three node kubernetes cluster 
+and have management connectivity to a fully sd-fabric compliant fabric.
+Please refer to step 1 to 4 in [SD-Fabric deployment guide](https://docs.sd-fabric.org/master/deployment.html)
+for prerequisites, and come back here for the rest of the installation instructions.
+
+### Hardware deployment 
+
+1. **Prepare your Helm value**
 
     You can modify existing `values.yaml` directly, but we recommend composing another value file `myvalues.yaml` using `values.yaml` as an example.
 
@@ -43,7 +141,7 @@
 
     - **Stratum `nodeSelector` and `tolerations`**
 
-        This has to be consistent with the information in prerequisite step 2.
+        This has to be consistent with the information in prerequisite step 1.
         Here's an example:
 
         ```
@@ -59,7 +157,7 @@
 
     - **SD-Fabric image access credential**
 
-        This has to be consistent with the information in prerequisite step 3.
+        This has to be consistent with the information in prerequisite step 2.
         ```
         image:
             credential:
@@ -69,7 +167,7 @@
 
     - **ONOS network config**
 
-        This has to be consistent with the information in prerequisite step 4.
+        This has to be consistent with the information in prerequisite step 3.
         ```
         onos-classic:
             config:
@@ -91,18 +189,18 @@
                 }
         ```
 
-4. **Verify custom values**
+2. **Verify custom values**
 
     ```bash
     helm template -f myvaules.yaml .
     ```
 
-5. **Supply Stratum chassis config**
+3. **Supply Stratum chassis config**
 
     Please refer to [Provide Chassis Config](https://github.com/stratum/stratum-helm-charts/tree/master/stratum#provide-chassis-config).
     This has to be consistent with the information in prerequisite step 5.
 
-6. **Install SD-Fabric helm chart**
+4. **Install SD-Fabric helm chart**
 
     The following command will deploy the SD-Fabric helm chart with release name `sdfabric` in the `sdfabric` namesapce.
     ```bash
diff --git a/sdfabric/dev-values.yaml b/sdfabric/dev-values.yaml
new file mode 100644
index 0000000..df1613e
--- /dev/null
+++ b/sdfabric/dev-values.yaml
@@ -0,0 +1,291 @@
+# SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
+#
+# SPDX-License-Identifier: Apache-2.0
+
+import:
+  onos-classic:
+    enabled: true
+  stratum:
+    enabled: false
+  pfcp-agent:
+    enabled: false
+  dbuf:
+    enabled: false
+  int-host-reporter:
+    enabled: false
+  di-topology-watchdog:
+    enabled: false
+  di-metrics-exporter:
+    enabled: false
+
+image:
+  credential: null
+
+onos-classic:
+  image:
+    repository: opennetworking/sdfabric-onos
+    tag: 1.1.1
+  replicas: 1
+
+  java_opts: >
+    -Xmx4G
+    -XX:+UseG1GC
+    -XX:MaxGCPauseMillis=200
+    -XX:-UseContainerSupport
+    -Dkaraf.log.console=INFO
+    -Dds.lock.timeout.milliseconds=10000
+    -Dlog4j2.formatMsgNoLookups=true
+#    -XX:+UnlockExperimentalVMOptions
+#    -XX:+UseZGC
+
+  ports:
+    - name: up4
+      port: 51001
+    - name: east-west
+      port: 9876
+    - name: cli
+      port: 8101
+    - name: ui
+      port: 8181
+
+  apps:
+    - org.onosproject.lldpprovider
+    - org.onosproject.netcfghostprovider
+    - org.onosproject.gui
+    - org.onosproject.drivers.barefoot
+    - org.onosproject.drivers.bmv2
+    - org.onosproject.segmentrouting
+    - org.omecproject.up4
+    - org.stratumproject.fabric-tna
+    - org.onosproject.dhcprelay
+
+  logging:
+    karafVersion: 4.2.14
+    config: |
+      # Common pattern layout for appenders
+      log4j2.stdout.pattern = %d{RFC3339} %-5level [%c{1}] %msg%n%throwable
+
+      # Root logger
+      log4j2.rootLogger.level = INFO
+
+      # OSGi appender
+      log4j2.rootLogger.appenderRef.PaxOsgi.ref = PaxOsgi
+      log4j2.appender.osgi.type = PaxOsgi
+      log4j2.appender.osgi.name = PaxOsgi
+      log4j2.appender.osgi.filter = *
+
+      # stdout appender
+      log4j2.rootLogger.appenderRef.Console.ref = Console
+      log4j2.appender.console.type = Console
+      log4j2.appender.console.name = Console
+      log4j2.appender.console.layout.type = PatternLayout
+      log4j2.appender.console.layout.pattern = ${log4j2.stdout.pattern}
+
+      # SSHD logger
+      log4j2.logger.sshd.name = org.apache.sshd
+      log4j2.logger.sshd.level = INFO
+
+      # Spifly logger
+      log4j2.logger.spifly.name = org.apache.aries.spifly
+      log4j2.logger.spifly.level = WARN
+
+  annotations:
+    fluentbit.io/parser: onos
+
+  atomix:
+    replicas: 1
+    persistence:
+      enabled: false
+    java_opts: >
+      -Xmx2G
+      -XX:-UseContainerSupport
+
+  # Please check the README to learn more
+  config:
+    componentConfig:
+      "org.onosproject.net.host.impl.HostManager": >
+        {
+          "monitorHosts": "true",
+          "probeRate": "10000"
+        }
+      "org.onosproject.segmentrouting.phasedrecovery.impl.PhasedRecoveryManager": >
+        {
+          "phasedRecovery": true
+        }
+    netcfg: >
+      {
+        "devices": {
+          "device:leaf1": {
+            "basic": {
+              "name": "leaf1",
+              "managementAddress": "grpc://mininet-stratum:50001?device_id=1",
+              "driver": "stratum-bmv2",
+              "pipeconf": "org.stratumproject.fabric-upf.bmv2",
+              "locType": "grid",
+              "gridX": 200,
+              "gridY": 600
+            },
+            "segmentrouting": {
+              "ipv4NodeSid": 101,
+              "ipv4Loopback": "192.168.1.1",
+              "routerMac": "00:AA:00:00:00:01",
+              "isEdgeRouter": true,
+              "adjacencySids": []
+            }
+          },
+          "device:leaf2": {
+            "basic": {
+              "name": "leaf2",
+              "managementAddress": "grpc://mininet-stratum:50002?device_id=1",
+              "driver": "stratum-bmv2",
+              "pipeconf": "org.stratumproject.fabric-upf.bmv2",
+              "locType": "grid",
+              "gridX": 800,
+              "gridY": 600
+            },
+            "segmentrouting": {
+              "ipv4NodeSid": 102,
+              "ipv4Loopback": "192.168.1.2",
+              "routerMac": "00:AA:00:00:00:02",
+              "isEdgeRouter": true,
+              "adjacencySids": []
+            }
+          },
+          "device:spine1": {
+            "basic": {
+              "name": "spine1",
+              "managementAddress": "grpc://mininet-stratum:50003?device_id=1",
+              "driver": "stratum-bmv2",
+              "pipeconf": "org.stratumproject.fabric.bmv2",
+              "locType": "grid",
+              "gridX": 400,
+              "gridY": 400
+            },
+            "segmentrouting": {
+              "ipv4NodeSid": 201,
+              "ipv4Loopback": "192.168.2.1",
+              "routerMac": "00:BB:00:00:00:01",
+              "isEdgeRouter": false,
+              "adjacencySids": []
+            }
+          },
+          "device:spine2": {
+            "basic": {
+              "name": "spine2",
+              "managementAddress": "grpc://mininet-stratum:50004?device_id=1",
+              "driver": "stratum-bmv2",
+              "pipeconf": "org.stratumproject.fabric.bmv2",
+              "locType": "grid",
+              "gridX": 600,
+              "gridY": 400
+            },
+            "segmentrouting": {
+              "ipv4NodeSid": 202,
+              "ipv4Loopback": "192.168.2.2",
+              "routerMac": "00:BB:00:00:00:02",
+              "isEdgeRouter": false,
+              "adjacencySids": []
+            }
+          }
+        },
+        "ports": {
+          "device:leaf1/3": {
+            "interfaces": [
+              {
+                "name": "leaf1-3",
+                "ips": [
+                  "172.16.1.254/24"
+                ],
+                "vlan-untagged": 100
+              }
+            ]
+          },
+          "device:leaf1/4": {
+            "interfaces": [
+              {
+                "name": "leaf1-4",
+                "ips": [
+                  "172.16.1.254/24"
+                ],
+                "vlan-untagged": 100
+              }
+            ]
+          },
+          "device:leaf1/5": {
+            "interfaces": [
+              {
+                "name": "leaf1-5",
+                "ips": [
+                  "172.16.1.254/24"
+                ],
+                "vlan-tagged": [
+                  100
+                ]
+              }
+            ]
+          },
+          "device:leaf1/6": {
+            "interfaces": [
+              {
+                "name": "leaf1-6",
+                "ips": [
+                  "172.16.2.254/24"
+                ],
+                "vlan-tagged": [
+                  200
+                ]
+              }
+            ]
+          }
+        },
+        "hosts": {
+          "00:00:00:00:00:1A/None": {
+            "basic": {
+              "name": "h1a",
+              "locType": "grid",
+              "gridX": 100,
+              "gridY": 700
+            }
+          },
+          "00:00:00:00:00:1B/None": {
+            "basic": {
+              "name": "h1b",
+              "locType": "grid",
+              "gridX": 100,
+              "gridY": 800
+            }
+          },
+          "00:00:00:00:00:1C/100": {
+            "basic": {
+              "name": "h1c",
+              "locType": "grid",
+              "gridX": 250,
+              "gridY": 800
+            }
+          },
+          "00:00:00:00:00:20/200": {
+            "basic": {
+              "name": "h2",
+              "locType": "grid",
+              "gridX": 400,
+              "gridY": 700
+            }
+          },
+          "00:00:00:00:00:30/300": {
+            "basic": {
+              "name": "h3",
+              "locType": "grid",
+              "gridX": 750,
+              "gridY": 700
+            }
+          },
+          "00:00:00:00:00:40/None": {
+            "basic": {
+              "name": "h4",
+              "locType": "grid",
+              "gridX": 850,
+              "gridY": 700
+            }
+          }
+        }
+      }
diff --git a/sdfabric/values.yaml b/sdfabric/values.yaml
index 90ee6c5..14a6152 100644
--- a/sdfabric/values.yaml
+++ b/sdfabric/values.yaml
@@ -19,13 +19,19 @@
     enabled: false
 
 onos-classic:
-  java_opts: -Xmx4G -Dlog4j2.formatMsgNoLookups=true -XX:+UnlockExperimentalVMOptions -XX:+UseZGC
+
   image:
     repository: opennetworking/sdfabric-onos
     tag: 1.1.1
 
   replicas: 3
 
+  java_opts: >
+    -Xmx4G
+    -Dlog4j2.formatMsgNoLookups=true
+    -XX:+UnlockExperimentalVMOptions
+    -XX:+UseZGC
+
   ports:
     - name: up4
       port: 51001
@@ -85,6 +91,9 @@
     replicas: 3
     persistence:
       enabled: false
+    java_opts: >
+      -Xmx2G
+      -XX:-UseContainerSupport
 
   # Please check the README to learn more
   config: