Sean Condon | b44c6ce | 2021-10-01 15:29:32 +0100 | [diff] [blame] | 1 | # SPDX-FileCopyrightText: 2021-present Open Networking Foundation <info@opennetworking.org> |
| 2 | # |
| 3 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 4 | |
| 5 | package aether_4_0_0 |
| 6 | |
| 7 | echo[config] { |
| 8 | config := input |
| 9 | } |
| 10 | |
| 11 | allowed[config] { |
| 12 | application := applications # refer to rule below |
| 13 | connectivity_service := connectivityservices |
| 14 | device_group := devicegroups |
| 15 | enterprise := enterprises |
| 16 | ip_domain := ip_domains |
| 17 | network := networks |
| 18 | site := sites |
| 19 | template := templates |
| 20 | traffic_class := trafficclasses |
| 21 | upf := upfs |
| 22 | vcs := vcss |
| 23 | config := { |
| 24 | "application": { |
| 25 | "application": [ |
| 26 | application |
| 27 | ] |
| 28 | }, |
| 29 | "connectivity-service": { |
| 30 | "connectivity-service": [ |
| 31 | connectivity_service |
| 32 | ] |
| 33 | }, |
| 34 | "device-group": { |
| 35 | "device-group": [ |
| 36 | device_group |
| 37 | ] |
| 38 | }, |
| 39 | "enterprise": { |
| 40 | "enterprise": [ |
| 41 | enterprise |
| 42 | ] |
| 43 | }, |
| 44 | "ip-domain": { |
| 45 | "ip-domain": [ |
| 46 | ip_domain |
| 47 | ] |
| 48 | }, |
| 49 | "network": { |
| 50 | "network": [ |
| 51 | network |
| 52 | ] |
| 53 | }, |
| 54 | "site": { |
| 55 | "site": [ |
| 56 | site |
| 57 | ] |
| 58 | }, |
| 59 | "template": { |
| 60 | "template": [ |
| 61 | template |
| 62 | ] |
| 63 | }, |
| 64 | "traffic_class": { |
| 65 | "traffic_class": { |
| 66 | traffic_class |
| 67 | } |
| 68 | }, |
| 69 | "upf": { |
| 70 | "upf": [ |
| 71 | upf |
| 72 | ] |
| 73 | }, |
| 74 | "vcs": { |
| 75 | "vcs": [ |
| 76 | vcs |
| 77 | ] |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | applications[application] { |
| 83 | application := input.application.application[_] |
| 84 | ["AetherROCAdmin", application.enterprise][_] == input.groups[i] |
| 85 | } |
| 86 | |
| 87 | connectivityservices[connectivity_service] { |
| 88 | connectivity_service := input.connectivity_service.connectivity_service[_] |
| 89 | } |
| 90 | |
| 91 | devicegroups[device_group] { |
| 92 | device_group := input.device_group.device_group[_] |
| 93 | site := sites |
| 94 | device_group.site == site[_].id # allow only the device_groups of a known site |
| 95 | } |
| 96 | |
| 97 | enterprises[enterprise] { |
| 98 | enterprise := input.enterprise.enterprise[_] |
| 99 | ["AetherROCAdmin", enterprise.id][_] == input.groups[i] |
| 100 | } |
| 101 | |
| 102 | ip_domains[ip_domain] { |
| 103 | ip_domain := input.ip_domain.ip_domain[_] |
| 104 | ["AetherROCAdmin", ip_domain.enterprise][_] == input.groups[i] |
| 105 | } |
| 106 | |
| 107 | networks[network] { |
| 108 | network := input.network.network[_] |
| 109 | ["AetherROCAdmin", network.enterprise][_] == input.groups[i] |
| 110 | } |
| 111 | |
| 112 | sites[site] { |
| 113 | site := input.site.site[_] |
| 114 | ["AetherROCAdmin", site.enterprise][_] == input.groups[i] |
| 115 | } |
| 116 | |
| 117 | templates[template] { |
| 118 | template := input.template.template[_] |
| 119 | } |
| 120 | |
| 121 | trafficclasses[traffic_class] { |
| 122 | traffic_class := input.traffic_class.traffic_class[_] |
| 123 | } |
| 124 | |
| 125 | upfs[upf] { |
| 126 | upf := input.upf.upf[_] |
| 127 | ["AetherROCAdmin", upf.enterprise][_] == input.groups[i] |
| 128 | } |
| 129 | |
| 130 | vcss[vcs] { |
| 131 | vcs := input.vcs.vcs[_] |
| 132 | ["AetherROCAdmin", vcs.enterprise][_] == input.groups[i] |
| 133 | } |
| 134 | |
| 135 | can_update_enterprise = true { |
| 136 | update_enterprise := input.updates.enterprise.enterprise[_] |
| 137 | ["AetherROCAdmin", update_enterprise.id][_] == input.groups[i] |
| 138 | } |