github.com/gophercloud/gophercloud@v1.11.0/openstack/networking/v2/extensions/qos/policies/testing/fixtures_test.go (about) 1 package testing 2 3 import ( 4 "time" 5 6 "github.com/gophercloud/gophercloud/openstack/networking/v2/extensions/qos/policies" 7 ) 8 9 const GetPortResponse = ` 10 { 11 "port": { 12 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 13 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 14 } 15 } 16 ` 17 18 const CreatePortRequest = ` 19 { 20 "port": { 21 "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", 22 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 23 } 24 } 25 ` 26 27 const CreatePortResponse = ` 28 { 29 "port": { 30 "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", 31 "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", 32 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 33 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 34 } 35 } 36 ` 37 38 const UpdatePortWithPolicyRequest = ` 39 { 40 "port": { 41 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 42 } 43 } 44 ` 45 46 const UpdatePortWithPolicyResponse = ` 47 { 48 "port": { 49 "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", 50 "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", 51 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 52 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 53 } 54 } 55 ` 56 57 const UpdatePortWithoutPolicyRequest = ` 58 { 59 "port": { 60 "qos_policy_id": null 61 } 62 } 63 ` 64 65 const UpdatePortWithoutPolicyResponse = ` 66 { 67 "port": { 68 "network_id": "a87cc70a-3e15-4acf-8205-9b711a3531b7", 69 "tenant_id": "d6700c0c9ffa4f1cb322cd4a1f3906fa", 70 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 71 "qos_policy_id": "" 72 } 73 } 74 ` 75 76 const GetNetworkResponse = ` 77 { 78 "network": { 79 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 80 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 81 } 82 } 83 ` 84 85 const CreateNetworkRequest = ` 86 { 87 "network": { 88 "name": "private", 89 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 90 } 91 } 92 ` 93 94 const CreateNetworkResponse = ` 95 { 96 "network": { 97 "tenant_id": "4fd44f30292945e481c7b8a0c8908869", 98 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 99 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 100 } 101 } 102 ` 103 104 const UpdateNetworkWithPolicyRequest = ` 105 { 106 "network": { 107 "name": "updated", 108 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 109 } 110 } 111 ` 112 113 const UpdateNetworkWithPolicyResponse = ` 114 { 115 "network": { 116 "tenant_id": "4fd44f30292945e481c7b8a0c8908869", 117 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 118 "name": "updated", 119 "qos_policy_id": "591e0597-39a6-4665-8149-2111d8de9a08" 120 } 121 } 122 ` 123 124 const UpdateNetworkWithoutPolicyRequest = ` 125 { 126 "network": { 127 "qos_policy_id": null 128 } 129 } 130 ` 131 132 const UpdateNetworkWithoutPolicyResponse = ` 133 { 134 "network": { 135 "tenant_id": "4fd44f30292945e481c7b8a0c8908869", 136 "id": "65c0ee9f-d634-4522-8954-51021b570b0d", 137 "qos_policy_id": "" 138 } 139 } 140 ` 141 142 const ListPoliciesResponse = ` 143 { 144 "policies": [ 145 { 146 "name": "bw-limiter", 147 "tags": [], 148 "rules": [ 149 { 150 "max_kbps": 3000, 151 "direction": "egress", 152 "qos_policy_id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 153 "type": "bandwidth_limit", 154 "id": "30a57f4a-336b-4382-8275-d708babd2241", 155 "max_burst_kbps": 300 156 } 157 ], 158 "tenant_id": "a77cbe0998374aed9a6798ad6c61677e", 159 "created_at": "2019-05-19T11:17:50Z", 160 "updated_at": "2019-05-19T11:17:57Z", 161 "is_default": false, 162 "revision_number": 1, 163 "shared": false, 164 "project_id": "a77cbe0998374aed9a6798ad6c61677e", 165 "id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 166 "description": "" 167 }, 168 { 169 "name": "no-rules", 170 "tags": [], 171 "rules": [], 172 "tenant_id": "a77cbe0998374aed9a6798ad6c61677e", 173 "created_at": "2019-06-01T10:38:58Z", 174 "updated_at": "2019-06-01T10:38:58Z", 175 "is_default": false, 176 "revision_number": 0, 177 "shared": false, 178 "project_id": "a77cbe0998374aed9a6798ad6c61677e", 179 "id": "d6e7c2fe-24dc-43be-a088-24b47d4f8f88", 180 "description": "" 181 } 182 ] 183 } 184 ` 185 186 var Policy1 = policies.Policy{ 187 Name: "bw-limiter", 188 Rules: []map[string]interface{}{ 189 { 190 "type": "bandwidth_limit", 191 "max_kbps": float64(3000), 192 "direction": "egress", 193 "qos_policy_id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 194 "max_burst_kbps": float64(300), 195 "id": "30a57f4a-336b-4382-8275-d708babd2241", 196 }, 197 }, 198 Tags: []string{}, 199 TenantID: "a77cbe0998374aed9a6798ad6c61677e", 200 CreatedAt: time.Date(2019, 5, 19, 11, 17, 50, 0, time.UTC), 201 UpdatedAt: time.Date(2019, 5, 19, 11, 17, 57, 0, time.UTC), 202 RevisionNumber: 1, 203 ProjectID: "a77cbe0998374aed9a6798ad6c61677e", 204 ID: "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 205 } 206 207 var Policy2 = policies.Policy{ 208 Name: "no-rules", 209 Tags: []string{}, 210 Rules: []map[string]interface{}{}, 211 TenantID: "a77cbe0998374aed9a6798ad6c61677e", 212 CreatedAt: time.Date(2019, 6, 1, 10, 38, 58, 0, time.UTC), 213 UpdatedAt: time.Date(2019, 6, 1, 10, 38, 58, 0, time.UTC), 214 RevisionNumber: 0, 215 ProjectID: "a77cbe0998374aed9a6798ad6c61677e", 216 ID: "d6e7c2fe-24dc-43be-a088-24b47d4f8f88", 217 } 218 219 const GetPolicyResponse = ` 220 { 221 "policy": { 222 "name": "bw-limiter", 223 "tags": [], 224 "rules": [ 225 { 226 "max_kbps": 3000, 227 "direction": "egress", 228 "qos_policy_id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 229 "type": "bandwidth_limit", 230 "id": "30a57f4a-336b-4382-8275-d708babd2241", 231 "max_burst_kbps": 300 232 } 233 ], 234 "tenant_id": "a77cbe0998374aed9a6798ad6c61677e", 235 "created_at": "2019-05-19T11:17:50Z", 236 "updated_at": "2019-05-19T11:17:57Z", 237 "is_default": false, 238 "revision_number": 1, 239 "shared": false, 240 "project_id": "a77cbe0998374aed9a6798ad6c61677e", 241 "id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 242 "description": "" 243 } 244 } 245 ` 246 247 const CreatePolicyRequest = ` 248 { 249 "policy": { 250 "name": "shared-default-policy", 251 "is_default": true, 252 "shared": true, 253 "description": "use-me" 254 } 255 } 256 ` 257 258 const CreatePolicyResponse = ` 259 { 260 "policy": { 261 "name": "shared-default-policy", 262 "tags": [], 263 "rules": [], 264 "tenant_id": "a77cbe0998374aed9a6798ad6c61677e", 265 "created_at": "2019-05-19T11:17:50Z", 266 "updated_at": "2019-05-19T11:17:57Z", 267 "is_default": true, 268 "revision_number": 0, 269 "shared": true, 270 "project_id": "a77cbe0998374aed9a6798ad6c61677e", 271 "id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 272 "description": "use-me" 273 } 274 } 275 ` 276 277 const UpdatePolicyRequest = ` 278 { 279 "policy": { 280 "name": "new-name", 281 "shared": true, 282 "description": "" 283 } 284 } 285 ` 286 287 const UpdatePolicyResponse = ` 288 { 289 "policy": { 290 "name": "new-name", 291 "tags": [], 292 "rules": [], 293 "tenant_id": "a77cbe0998374aed9a6798ad6c61677e", 294 "created_at": "2019-05-19T11:17:50Z", 295 "updated_at": "2019-06-01T13:17:57Z", 296 "is_default": false, 297 "revision_number": 1, 298 "shared": true, 299 "project_id": "a77cbe0998374aed9a6798ad6c61677e", 300 "id": "d6ae28ce-fcb5-4180-aa62-d260a27e09ae", 301 "description": "" 302 } 303 } 304 `