f-62: e2e: MAC fournie par le harnais, VM à MAC arbitraire, interface sans mac refusée #62
Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
parent
077141443e
commit
11eb7f22a9
6 changed files with 46 additions and 18 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# fonctionnalité: validation de l'API — refus synchrones (400, 409, 422) des VPC, subnets et VM, sans trace en base
|
||||
# hôtes: hv1
|
||||
# tickets: #41, #57, #33
|
||||
# tickets: #41, #57, #33, #62
|
||||
|
||||
on hv1 <<'NODE'
|
||||
check "VPC vp-t11a, l3vni 1100 (témoin)" vpc_create vp-t11a 10.11.0.0/16 1100
|
||||
|
|
@ -39,6 +39,7 @@ for case in "gateway calculée:sn-t11a:10.11.1.254" "adresse d'émission:sn-t11a
|
|||
done
|
||||
check "VM : subnet inconnu, 422" expect_code 422 api_post_code vms "$(vm_body t11-x sn-t11z 10.11.1.12 "${NONE}")"
|
||||
check "VM : aucune interface primaire, 400" expect_code 400 api_post_code vms "$(vm_body t11-x sn-t11a 10.11.1.12 "${NONE}" | sed 's/"primary":true/"primary":false/')"
|
||||
check "VM : interface sans mac, 400" expect_code 400 api_post_code vms "$(vm_body t11-x sn-t11a 10.11.1.12 "${NONE}" | jq -c 'del(.interfaces[0].mac)')"
|
||||
check "VM : user_data en base64 invalide, 400" expect_code 400 api_post_code vms "$(vm_body t11-x sn-t11a 10.11.1.12 "${NONE}" '{"user_data":"pas du base64 !"}')"
|
||||
check "VMs refusées : aucune trace de t11-x" expect_code 404 api_code GET vms/t11-x
|
||||
cp "${TWO_IMAGE}" "${VOLUMES}/t11-ud.qcow2"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# fonctionnalité: DHCP par le serveur intégré (backend two) — bail, server-id, renouvellement, option 121, un serveur par subnet, démarrages simultanés
|
||||
# hôtes: hv1
|
||||
# tickets: #46, #57
|
||||
# tickets: #46, #57, #62
|
||||
|
||||
on hv1 <<'NODE'
|
||||
KEY=$(vm_key)
|
||||
|
|
@ -33,8 +33,13 @@ done
|
|||
check "10.21.1.10 : bail renouvelé (networkctl renew)" lease_renewed vp-t21 10.21.1.10
|
||||
check "10.21.1.10 : même adresse après le renouvellement" has_addr vp-t21 10.21.1.10
|
||||
check "10.21.1.10 : renouvellement servi par la gateway" test "$(vm_lease vp-t21 10.21.1.10 SERVER_ADDRESS)" = 10.21.1.254
|
||||
check "VM t21-m : MAC 02:de:ad:be:ef:01 fournie, sans lien avec son adresse 10.21.1.12" vm_launch t21-m --nic sn-t21a=10.21.1.12=02:de:ad:be:ef:01 --sshkey "${KEY}"
|
||||
check "t21-m joignable" vm_wait vp-t21 10.21.1.12
|
||||
check "t21-m : l'invité voit la MAC fournie sur ens3" test "$(vm_ssh vp-t21 10.21.1.12 'cat /sys/class/net/ens3/address')" = 02:de:ad:be:ef:01
|
||||
check "t21-m : bail de 10.21.1.12 servi par la gateway" test "$(vm_lease vp-t21 10.21.1.12 SERVER_ADDRESS)" = 10.21.1.254
|
||||
check "t21-m : l'API rend la MAC fournie" test "$(curl -fsS "${API}/vms/t21-m" | jq -r '.interfaces[0].mac')" = 02:de:ad:be:ef:01
|
||||
vm_host () { echo "$(vm_ssh vp-t21 "${1}" 'cat /sys/class/net/ens3/address')=${1}"; }
|
||||
A_HOSTS=$(printf '%s\n' "$(vm_host 10.21.1.10)" "$(vm_host 10.21.1.11)" | sort | tr '\n' ' ' | sed 's/ $//')
|
||||
A_HOSTS=$(printf '%s\n' "$(vm_host 10.21.1.10)" "$(vm_host 10.21.1.11)" "$(vm_host 10.21.1.12)" | sort | tr '\n' ' ' | sed 's/ $//')
|
||||
B_HOSTS=$(printf '%s\n' "$(vm_host 10.21.2.10)" "$(vm_host 10.21.2.11)" | sort | tr '\n' ' ' | sed 's/ $//')
|
||||
info "sn-t21a : ${A_HOSTS} ; sn-t21b : ${B_HOSTS}"
|
||||
check "probe sn-t21a : uniquement les couples MAC/IP de sn-t21a" test "$(dhcp_hosts vp-t21_br-t21a)" = "${A_HOSTS}"
|
||||
|
|
|
|||
|
|
@ -22,5 +22,5 @@ check "t25-m : route /32 des métadonnées présente" vm_grep vp-t25 10.25.1.10
|
|||
nic_macs () { ps -eo args | grep "[q]emu.*${1}" | grep -oE 'mac=[0-9A-Fa-f:]+' | sort | uniq | wc -l; }
|
||||
check "t25-m : deux MAC distinctes sur la ligne QEMU (témoin)" test "$(nic_macs t25-m)" -eq 2
|
||||
check "VM t25-r : deux NIC de même rang (10.25.1.30, 10.25.2.30)" vm_launch t25-r --nic sn-t25a=10.25.1.30 --nic sn-t25b=10.25.2.30 --sshkey "${KEY}"
|
||||
known "#62" "t25-r : deux NIC de même rang reçoivent des MAC distinctes" test "$(nic_macs t25-r)" -eq 2
|
||||
check "t25-r : deux NIC de même rang reçoivent des MAC distinctes" test "$(nic_macs t25-r)" -eq 2
|
||||
NODE
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue