<commit_before>heat_template_version: wallaby

description: >
  OpenStack containerized OVN DBs service in cluster mode

parameters:
  ContainerOvnNbDbImage:
    description: image
    type: string
    tags:
      - role_specific
  ContainerOvnSbDbImage:
    description: image
    type: string
    tags:
      - role_specific
  ContainerOvnNorthdImage:
    description: image
    type: string
    tags:
      - role_specific
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  ServiceData:
    default: {}
    description: Dictionary packing service data
    type: json
  ServiceNetMap:
    default: {}
    description: Mapping of service_name -> network name. Typically set
                 via parameter_defaults in the resource registry.  This
                 mapping overrides those in ServiceNetMapDefaults.
    type: json
  RoleName:
    default: ''
    description: Role name on which the service is applied
    type: string
  RoleParameters:
    default: {}
    description: Parameters specific to the role
    type: json
  OVNOvsdbProbeInterval:
    description: Probe interval in ms for the OVSDB session
    type: number
    default: 60000
  OVNNorthboundServerPort:
    description: Port of the OVN Northbound DB server
    type: number
    default: 6641
  OVNSouthboundServerPort:
    description: Port of the OVN Southbound DB server
    type: number
    default: 6642
  OVNNorthboundClusterPort:
    description: Cluster port of the OVN Northbound DB server
    type: number
    default: 6643
  OVNSouthboundClusterPort:
    description: Cluster port of the OVN Southbound DB server
    type: number
    default: 6644
  EnableInternalTLS:
    type: boolean
    default: false
  InternalTLSCAFile:
    default: '/etc/ipa/ca.crt'
    type: string
    description: Specifies the default CA cert to use if TLS is used for
                 services in the internal network.
  CertificateKeySize:
    type: string
    default: '2048'
    description: Specifies the private key size used when creating the
                 certificate.
  OvnDBSCertificateKeySize:
    type: string
    default: ''
    description: Override the private key size used when creating the
                 certificate for this service

conditions:
  key_size_override_unset: {equals: [{get_param: OvnDBSCertificateKeySize}, '']}
  is_ipv6:
    equals:
      - {get_param: [ServiceData, net_ip_version_map, {get_param: [ServiceNetMap, OvnDbsNetwork]}]}
      - 6

resources:

  ContainersCommon:
    type: ../containers-common.yaml

  RoleParametersValue:
    type: OS::Heat::Value
    properties:
      type: json
      value:
        map_replace:
          - map_replace:
            - ContainerOvnNbDbImage: ContainerOvnNbDbImage
              ContainerOvnSbDbImage: ContainerOvnSbDbImage
              ContainerOvnNorthdImage: ContainerOvnNorthdImage
            - values: {get_param: [RoleParameters]}
          - values:
              ContainerOvnNbDbImage: {get_param: ContainerOvnNbDbImage}
              ContainerOvnSbDbImage: {get_param: ContainerOvnSbDbImage}
              ContainerOvnNorthdImage: {get_param: ContainerOvnNorthdImage}

outputs:
  role_data:
    description: Role data for the OVN multi-active cluster role.
    value:
      service_name: ovn_dbs
      firewall_rules:
        map_merge:
          repeat:
            for_each:
              <%net_cidr%>:
                get_param:
                  - ServiceData
                  - net_cidr_map
                  - {get_param: [ServiceNetMap, OvnDbsNetwork]}
            template:
              '121 OVN DB server and cluster ports':
                proto: 'tcp'
                source: <%net_cidr%>
                dport:
                  - {get_param: OVNNorthboundServerPort}
                  - {get_param: OVNSouthboundServerPort}
                  - {get_param: OVNNorthboundClusterPort}
                  - {get_param: OVNSouthboundClusterPort}
      kolla_config:
        /var/lib/kolla/config_files/ovn_cluster_north_db_server.json:
          command: bash -c $* -- eval source /etc/sysconfig/ovn_cluster; exec /usr/local/bin/start-nb-db-server ${OVN_NB_DB_OPTS}
          config_files: &ovn_dbs_kolla_config_files
            - source: "/var/lib/kolla/config_files/src/*"
              dest: "/"
              merge: true<commit_msg>Fix merge of multiple firewall rules<commit_after>heat_template_version: wallaby

description: >
  OpenStack containerized OVN DBs service in cluster mode

parameters:
  ContainerOvnNbDbImage:
    description: image
    type: string
    tags:
      - role_specific
  ContainerOvnSbDbImage:
    description: image
    type: string
    tags:
      - role_specific
  ContainerOvnNorthdImage:
    description: image
    type: string
    tags:
      - role_specific
  EndpointMap:
    default: {}
    description: Mapping of service endpoint -> protocol. Typically set
                 via parameter_defaults in the resource registry.
    type: json
  ServiceData:
    default: {}
    description: Dictionary packing service data
    type: json
  ServiceNetMap:
    default: {}
    description: Mapping of service_name -> network name. Typically set
                 via parameter_defaults in the resource registry.  This
                 mapping overrides those in ServiceNetMapDefaults.
    type: json
  RoleName:
    default: ''
    description: Role name on which the service is applied
    type: string
  RoleParameters:
    default: {}
    description: Parameters specific to the role
    type: json
  OVNOvsdbProbeInterval:
    description: Probe interval in ms for the OVSDB session
    type: number
    default: 60000
  OVNNorthboundServerPort:
    description: Port of the OVN Northbound DB server
    type: number
    default: 6641
  OVNSouthboundServerPort:
    description: Port of the OVN Southbound DB server
    type: number
    default: 6642
  OVNNorthboundClusterPort:
    description: Cluster port of the OVN Northbound DB server
    type: number
    default: 6643
  OVNSouthboundClusterPort:
    description: Cluster port of the OVN Southbound DB server
    type: number
    default: 6644
  EnableInternalTLS:
    type: boolean
    default: false
  InternalTLSCAFile:
    default: '/etc/ipa/ca.crt'
    type: string
    description: Specifies the default CA cert to use if TLS is used for
                 services in the internal network.
  CertificateKeySize:
    type: string
    default: '2048'
    description: Specifies the private key size used when creating the
                 certificate.
  OvnDBSCertificateKeySize:
    type: string
    default: ''
    description: Override the private key size used when creating the
                 certificate for this service

conditions:
  key_size_override_unset: {equals: [{get_param: OvnDBSCertificateKeySize}, '']}
  is_ipv6:
    equals:
      - {get_param: [ServiceData, net_ip_version_map, {get_param: [ServiceNetMap, OvnDbsNetwork]}]}
      - 6

resources:

  ContainersCommon:
    type: ../containers-common.yaml

  RoleParametersValue:
    type: OS::Heat::Value
    properties:
      type: json
      value:
        map_replace:
          - map_replace:
            - ContainerOvnNbDbImage: ContainerOvnNbDbImage
              ContainerOvnSbDbImage: ContainerOvnSbDbImage
              ContainerOvnNorthdImage: ContainerOvnNorthdImage
            - values: {get_param: [RoleParameters]}
          - values:
              ContainerOvnNbDbImage: {get_param: ContainerOvnNbDbImage}
              ContainerOvnSbDbImage: {get_param: ContainerOvnSbDbImage}
              ContainerOvnNorthdImage: {get_param: ContainerOvnNorthdImage}

outputs:
  role_data:
    description: Role data for the OVN multi-active cluster role.
    value:
      service_name: ovn_dbs
      firewall_rules:
        map_merge:
          repeat:
            for_each:
              <%net_cidr%>:
                get_param:
                  - ServiceData
                  - net_cidr_map
                  - {get_param: [ServiceNetMap, OvnDbsNetwork]}
            template:
              '121 OVN DB server and cluster ports for <%net_cidr%>':
                proto: 'tcp'
                source: <%net_cidr%>
                dport:
                  - {get_param: OVNNorthboundServerPort}
                  - {get_param: OVNSouthboundServerPort}
                  - {get_param: OVNNorthboundClusterPort}
                  - {get_param: OVNSouthboundClusterPort}
      kolla_config:
        /var/lib/kolla/config_files/ovn_cluster_north_db_server.json:
          command: bash -c $* -- eval source /etc/sysconfig/ovn_cluster; exec /usr/local/bin/start-nb-db-server ${OVN_NB_DB_OPTS}
          config_files: &ovn_dbs_kolla_config_files
            - source: "/var/lib/kolla/config_files/src/*"
              dest: "/"
              merge: true
{'fraction_non_alphanumeric': 0.06403940886699508, 'fraction_numerical': 0.006717420510523959, 'mean_word_length': 2.3507126781695424, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3859516', 'n_tokens_mistral': 2694, 'n_tokens_neox': 2511, 'n_words': 700}