# Copyright 2018-present Open Networking Foundation
#
# 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.

# Configures the Atomix cluster for ONOS.
cluster {
  # The 'clusterId' should match the 'name' field in ONOS cluster.json.
  clusterId: onos

  # The 'discovery' configuration defines how the *Atomix* nodes bootstrap.
  # The ONOS cluster will typically connect to the bootstrap nodes defined in cluster.json:
  # {
  #   "storage": [
  #     {
  #       "id": "atomix-1",
  #       "host": "10.192.19.171"
  #       "port": 5679
  #     },
  #     {
  #       "id": "atomix-2",
  #       "host": "10.192.19.172"
  #       "port": 5679
  #     },
  #     {
  #       "id": "atomix-3",
  #       "host": "10.192.19.173"
  #       "port": 5679
  #     }
  #   ]
  # }
  discovery {
    type: bootstrap
    nodes.1 {
      id: atomix-1
      address: "10.192.19.171:5679"
    }
    nodes.2 {
      id: atomix-2
      address: "10.192.19.172:5679"
    }
    nodes.3 {
      id: atomix-3
      address: "10.192.19.173:5679"
    }
  }
}

# ONOS requires that the 'managementGroup' define a Raft partition group to use for primitive management.
# This partition group should typically consist of only a single partition with the default partition size.
managementGroup {
  type: raft
  partitions: 1
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}

# ONOS requires that 'partitionGroups' include a single Raft partition for consistent primitives.
# The number of partitions should typically be set to 1 or 2 times the number of members in the
# Atomix cluster. The 'partitionSize' indicates the number of nodes in each partition and should
# be an odd number, usually 3 or 5. The 'storage.level' may be either 'disk' or 'mapped' for
# memory mapped Raft logs.
partitionGroups.raft {
  type: raft
  partitions: 3
  partitionSize: 3
  storage.level: disk
  members: [atomix-1, atomix-2, atomix-3]
}
