Network template lacks API validation

Bug #1476779 reported by Ryan Moe on 2015-07-21
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fuel for OpenStack
High
Ivan Kliuk

Bug Description

Network templates are not validated by the API handler at upload time. API support for network templates was introduced here: https://review.openstack.org/#/c/196886/

Ryan Moe (rmoe) on 2015-07-21
Changed in fuel:
assignee: nobody → Ryan Moe (rmoe)
milestone: none → 7.0
status: New → Confirmed
Aleksey Kasatkin (alekseyk-ru) wrote :

AFAIC, we need validation in several places in API: when template is loaded, nodes are added, set of node roles is changed for some nodes. Now validation for templates is introduced here https://review.openstack.org/#/c/197145/ (in CheckBeforeDeploymentTask).

Please look at the discussion in
https://review.openstack.org/#/c/197145/35/nailgun/nailgun/orchestrator/neutron_serializers.py
L953

Changed in fuel:
importance: Undecided → High
Ihor Kalnytskyi (ikalnytskyi) wrote :

As I said in the email thread in openstack-dev, I'd move this bug to 7.1. It doesn't look so simple, and it looks like a feature to me rather a bug.

Aleksey Kasatkin (alekseyk-ru) wrote :

We could create separate bug to track basic validation for template (like its structure, consistency, etc.). And more complicated things (like all mentioned nodes and roles are present and used correctly) to be tracked here. Opinions?

Aleksey Kasatkin (alekseyk-ru) wrote :

Seems, we cannot do anything while node is being added or its roles are being changed. AFAIC, we should not forbid the change of nodes' set or roles' set for node if they are not in costistency with the current template. And do not reset the current template either. We could just raise an error when serialization of template is requested or introduce some flag that will show is the current template in consistency with the environment's configuration.
The second thing to do is to check the template itself for its consistency while it is being loaded.

Aleksey Kasatkin (alekseyk-ru) wrote :

I propose to provide validation for the following:
1. Schema
2. Consistency of template (all templates mentioned for node roles are present, templates are not redefined with the same names, network_assignments are consistent, node roles and network roles mentioned are known in particular env)

New ticket should be filed to provide some more complicated validation.

Ivan Kliuk (ivankliuk) on 2015-07-28
Changed in fuel:
assignee: Ryan Moe (rmoe) → Ivan Kliuk (ivankliuk)

Fix proposed to branch: master
Review: https://review.openstack.org/206468

Changed in fuel:
status: Confirmed → In Progress
Aleksey Kasatkin (alekseyk-ru) wrote :

node roles and network roles mentioned are known in particular env - this is validated CheckBeforeDeploymentTask. There is no sense to validate it when template is being loaded as node roles and network roles set can be changed on the fly.
Same for network_assignments consistency as set of networks is variable.

So, we have to check:
1. Schema
2. Consistency of template (all templates mentioned for node roles are present, templates are not redefined with the same names)

Changed in fuel:
assignee: Ivan Kliuk (ivankliuk) → Aleksey Kasatkin (alekseyk-ru)
Changed in fuel:
assignee: Aleksey Kasatkin (alekseyk-ru) → Ivan Kliuk (ivankliuk)

Reviewed: https://review.openstack.org/206468
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=b2b7b3c10bc2f1486adee0c5f4eafca262f31f0e
Submitter: Jenkins
Branch: master

commit b2b7b3c10bc2f1486adee0c5f4eafca262f31f0e
Author: Ivan Kliuk <email address hidden>
Date: Thu Jul 23 21:13:49 2015 +0300

    Add validation for network templates

    * Add validation using JSON scheme;
    * Add validation of template consistency;
    * Add corresponding unit tests.

    Change-Id: I21cfa9a2b9d4b8d194851e13d5967de0a908dd3a
    Closes-Bug: #1476779

Changed in fuel:
status: In Progress → Fix Committed
Andrew Woodward (xarses) on 2015-07-29
tags: added: feature-network-template

Reviewed: https://review.openstack.org/207085
Committed: https://git.openstack.org/cgit/stackforge/fuel-web/commit/?id=08bff9218af0ce23f15396e2a1b0e3d73013ed40
Submitter: Jenkins
Branch: master

commit 08bff9218af0ce23f15396e2a1b0e3d73013ed40
Author: Ivan Kliuk <email address hidden>
Date: Fri Jul 24 09:46:52 2015 +0300

    Additional tests for network template validator

    * Extract often used assert-methods into 'BaseValidatorTest' class;
    * Add comprehensive tests for JSON-schema validation.

    Change-Id: Iaf7f36c30fbd86f389ed62b457632de0c1dc05cb
    Related-bug: #1476779

tags: added: on-verification

Verified on 292 ISO.
VERSION:
  feature_groups:
    - mirantis
  production: "docker"
  release: "7.0"
  openstack_version: "2015.1.0-7.0"
  api: "1.0"
  build_number: "292"
  build_id: "292"
  nailgun_sha: "16a39d40120dd4257698795f12de4ae8200b1778"
  python-fuelclient_sha: "2864459e27b0510a0f7aedac6cdf27901ef5c481"
  fuel-agent_sha: "082a47bf014002e515001be05f99040437281a2d"
  fuel-nailgun-agent_sha: "d7027952870a35db8dc52f185bb1158cdd3d1ebd"
  astute_sha: "a717657232721a7fafc67ff5e1c696c9dbeb0b95"
  fuel-library_sha: "0c5a39a43bffaddc91b46179d16e1bb2dd85bc0c"
  fuel-ostf_sha: "1f08e6e71021179b9881a824d9c999957fcc7045"
  fuelmain_sha: "6b83d6a6a75bf7bca3177fcf63b2eebbf1ad0a85"

Changed in fuel:
status: Fix Committed → Fix Released
tags: removed: on-verification
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers