Difference between revisions of "NFV SpecFest Wiki"

From ETSI Forge
Jump to: navigation, search
Line 32: Line 32:
 
|}
 
|}
  
To edit the OpenApi specification online:
+
=== Edit Resource and Operation ===
  
# Open the in a new tab [https://forge.etsi.org/swagger/editor/?url=https://forge.etsi.org/rep/gitweb.cgi/nfv-specfest.git/blob_plain/HEAD:/sol002-template.yaml <big>template of a specification</big>]: this will be your starting point; it is a already structured file where you will need to insert the appropriate values take from SOL002 specification;
+
You are now ready to edit the OpenApi specification online. Below you will find the link to the online editor which will contain a template with comments and instruction on how to fill the required information. Please note:
# Look up SOL002, Section 5.4.2.2
 
  
(Insert images here)
+
* If you close the Editor page, you will loose all your work.
 +
* The template is divided in two parts: resources and data types. You can decide to stop editing after the resources part or to continue with the data types definition.
 +
* Once you are done editing, '''do not close the editor page''' and come back to this wiki page for the next steps.
 +
* If you are in doubt, check the expected result at [https://forge.etsi.org/swagger/editor/?url=https://forge.etsi.org/rep/gitweb.cgi/nfv-specfest.git/blob_plain/HEAD:/sol002-example.yaml <big>Solution</big>] (open this file in a new tab or window);
  
# Create the definition into the nfv002_main_template.yaml and check correctness with VS Code
+
--> [https://forge.etsi.org/swagger/editor/?url=https://forge.etsi.org/rep/gitweb.cgi/nfv-specfest.git/blob_plain/HEAD:/sol002-template.yaml <big>Template to edit</big>] <--
# Cut&paste what you created into a proper resource in /paths/index.yaml and create the corresponding file
+
(Open it in a new tab with right click menu or hold Ctrl key and click on the link)
# E.g. create the Vnf_instance data type into a Vnf_instance.yaml file
 
# Configure the files so that the CI/CD validates the result
 
# [https://forge.etsi.org/swagger/editor/?url=https://forge.etsi.org/rep/gitweb.cgi/nfv-specfest.git/blob_plain/HEAD:/sol002-example.yaml <big>An example of specification</big>]: this is how your work should look like at the end;
 
  
 
== Step 2: Upload it to the ETSI Forge ==
 
== Step 2: Upload it to the ETSI Forge ==

Revision as of 11:51, 22 August 2017

Warning: This page is a working draft. Information could be missing or unreliable. Contact the administrator for more support.

Upload an OpenAPI specification to the ETSI Forge!

Welcome to the Wiki page for the NFV SpecFest event.

Today you have the opportunity to participate in the first collaborative OpenAPI specification on the ETSI Forge. The proposed activity aims at translating an extract of an ETSI NFV specification into a machine readable API description, formatted in the OpenAPIs language.

The specification used for the task will be ETSI NFV GS SOL 002 [1](Download here).

What you need:

Let's get started!

Step 0: Set up

  1. Log in at ETSI Forge using your EOL account information.
  2. If you do not have an account yet, you can register for a Forge account here.

Step 1: Edit the template

Make sure you are using Google Chrome or Opera as your browser from this point on.

Edit Resource and Operation

You are now ready to edit the OpenApi specification online. Below you will find the link to the online editor which will contain a template with comments and instruction on how to fill the required information. Please note:

  • If you close the Editor page, you will loose all your work.
  • The template is divided in two parts: resources and data types. You can decide to stop editing after the resources part or to continue with the data types definition.
  • Once you are done editing, do not close the editor page and come back to this wiki page for the next steps.
  • If you are in doubt, check the expected result at Solution (open this file in a new tab or window);

--> Template to edit <-- (Open it in a new tab with right click menu or hold Ctrl key and click on the link)

Step 2: Upload it to the ETSI Forge

  • Navigate to the project page of nfv-specfest
    • Click on the Sign in link on the top right and the page and log in with your EOL or Forge credentials
    • Click on the menu Projects -> List -> nfv-specfest
  • Click ‘Create Change’ button
    • Enter Branch: master
    • Enter Change title
    • Enter Change description
    • Click on Create
  • Click 'Edit' in the File list at the bottom of the page
  • Now click "Add" to insert a new modification in a file
    • If you type the name of a file already existing in the repository, that file will be opened for editing. If otherwise, you type a new file name, the file will be created.
    • As you type, Gerrit will suggest names of files and folder in the repo.
  • Now click on the file to open it in the online editor.
  • Paste the content you created in your local editor or with the online editor.
  • Click Save and Close
  • Now click the blue Publish button on the top right of the page.

Step 3: Verify

  1. Check Jenkins result on Gerrit and on Jenkins Job (go to https://forge.etsi.org/gerrit/#/dashboard/self)
To verify that the content of the contribution has been validated, look for the text you see in the red boxes in the picture.
  1. If there is no feedback from Jenkins contact CTI
  2. Wait for CTI to merge your contribution

Iterate!

All accomplished? Then it may be time to select a new part of the specification and create the OpenAPI version again!

A live spreadsheet is available to keep track of "who is doing what".

    • Open the given spreadsheet and tag one operation with your name
    • The operation will then be assigned to you to be edited

Bonus level

OpenAPI v2 language reference

Find OpenAPI Specification v2: the official and complete reference of the language.

Optional: Install an offline Editor application on your system

It is possible to edit and submit the specification files directly in the browser without the need of installing anything. But that method is a bit more error prone and sometimes less comfortable, therefore a better workflow would require an Editor locally installed on your machine. We list below two different options, both free, open source and with extensions to facilitate work with OpenAPIs.

Anyway, feel free to use your preferred editor: you will need to submit only the plain text.

VS Code

  1. Navigate to VS Code homepage, download the installer for your platform and execute it
  2. Install the Swagger Viewer Plugin

Editing with VS Code Example

Visual Studio Code is a multiplatform, free and open source, extensible editor by Microsoft (similar to SublimeText and Atom Editor). For VS Code a handy plugin is available to render OpenAPIs documentation while typing, therefore we selected this as a suitable tool for our activity. Anyway, feel free to use your preferred editor for the task.

Find below the instructions to render OpenAPI doc in VS Code:

  1. Open the template file with VS Code (e.g. open or paste the template file sol002-template.yaml)
  1. Press F1, then write "Swagger preview" and hit Enter. A new tab will open to show the graphical representation of the file. Note that as soon as you change the text, the other tab is automatically updated.

Atom Editor

  1. Navigate to Atom homepage, download the installer for your platform and execute it.
  2. Install the linter-swagger plugin.

Optional: Set up Git

To install and configure Git on your machine please refer to Get started.

Optional: Upload the contribution via Git

  1. Upload the contribution via the usual git workflow (please note the unusual push operation endpoint)
  $ git add .
  $ git commit -s -m "your message here"
  $ git push origin HEAD:refs/for/master

More on the starter kit

  • A repository at the Forge, with the folder structure, a template of specification file and some examples. Click here to visit the repository.
  • A live spreadsheet to keep track of "who is doing what"
    • Open the given spreadsheet and tag one operation with your name
    • The operation will then be assigned to you to be edited

References

<references />

Template:Reflist