Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Warning
titleALERT
This macro has been removed by LF IT, a workaround is in progress.

How to use:

  1. Click on the "Generate ID" button and wait for an alert the requirement to pop show up with in the Requirement ID field.
  2. The Requirement ID will be passed into the "Requirement ID" field in the form.
  3. Fill out and edit the form as needed.
    1. Please fill out all fields, if you are not sure what to put, please refer to: VNFRQTS How to ContributeRequirement and Documentation Standards
  4. Click on the "Generate RST" button.
  5. There will be a new section added under with the requirement properly formatted into RST which can be copied and pasted to be used as needed.
    1. Moving forward, you can do one of two things with the generated RST:
      1. Copy and paste this into the JIRA ticket associated in: https://jira.onap.org/projects/VNFRQTS/issues/
      2. Copy and paste this into the appropriate Chapter and Section in the RST document cloned from: https://gerrit.onap.org/r/#/admin/projects/vnfrqts/requirements and submit a gerrit review.
        1. To understand how to do this, please refer to VNFRQTS How to Contribute for more information on how to set up the prerequisites for all necessary tools to make changes.
        2. NOTE: This tool ONLY generates the RST, it does not automatically add it to JIRA or into Gerrit, those will have to be done manually. It is important to understand how to make changes in Git/Gerrit before using this tool so please refer to: VNFRQTS How to Contribute
          1. If you still have any questions or concerns please contact: Hagop Bozawglanian
  6. video walkthrough. 


Expand


HTML

<html>

  <body>

    <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button>

    <form id="req">
      <div id="sections">
        <div class="section">
          <fieldset>
            <p>
              <label for="id">Requirement ID:</label>
              <input style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly class="required" />
            </p>
            <p>
              <label for="target">Target:</label>
              <select onchange="buildReq(target)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="target" id="target" class="required">
               <option value="" hidden>Select Target</option>
               <option value="VNF">VNF</option>
               <option value="PNF">PNF</option>
               <option value="VNF or PNF">VNF or PNF</option>
               <option value="VNF PROVIDER">VNF PROVIDER</option>
               <option value="PNF PROVIDER">PNF PROVIDER</option>
               <option value="VNF or PNF PROVIDER">VNF or PNF PROVIDER</option>
               <option value="VNF HEAT PACKAGE">VNF HEAT PACKAGE</option>
               <option value="VNF CSAR PACKAGE">VNF CSAR PACKAGE</option>
               <option value="PNF CSAR PACKAGE">PNF CSAR PACKAGE</option>
               <option value="VNF or PNF CSAR PACKAGE">VNF or PNF CSAR PACKAGE</option>
               <option value="VNF DOCUMENTATION PACKAGE">VNF DOCUMENTATION PACKAGE</option>
               <option value="PNF DOCUMENTATION PACKAGE">PNF DOCUMENTATION PACKAGE</option>
               <option value="VNF or PNF DOCUMENTATION PACKAGE">VNF or PNF DOCUMENTATION PACKAGE</option>
              </select>
            </p>
            <p>
              <label for="keyword">Keyword:</label>
              <select onchange="buildReq(keyword)" style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="keyword" id="keyword" class="required">
               <option value="" hidden>Select Keyword</option>
HTML
<html> <body> <button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" id="generate">Generate ID</button> <form id="req">

      
<div
 
id="sections">
        
<div
<option 
class
value="
section">
**MUST**">MUST</option>
          
<fieldset>
     <option value="**MUST NOT**">MUST NOT</option>
    
<legend>Requirement</legend>
           
<p>
<option value="**SHOULD**">SHOULD</option>
              
<label
 <option 
for
value="
id">Requirement ID:</label>
**SHOULD NOT**">SHOULD NOT</option>
              
<input
 <option 
style
value="
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="id" id="id" value="" type="text" readonly/>
**MAY**">MAY</option>
              </select>
            </p>
            <p>
              <label for="
keyword
introduced"
>Keyword
>Introduced:</label>
              <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="
keyword
introduced">
               
<option value="
MUST
amsterdam"
>MUST<
>amsterdam</option>
               
<option value="
MUST NOT">MUST NOT<
beijing">beijing</option>
               <option value="
SHOULD
casablanca"
>SHOULD<
>casablanca</option>
               
<option value="
SHOULD NOT">SHOULD NOT<
dublin" selected="selected">dublin</option>
               <option value="
MAY">MAY<
el alto">el alto</option>
              </select>
            </p>
            <p>
              <label for="
target
impacts"
>Target
>Impacts*:</label>
              <select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="
target
impacts"
> <option value="VNF">VNF</option>
 size="10" multiple>
               <option value="
VNFC
AAI"
>VNFC<
>AAI</option>
               <option value="
VNF PROVIDER">VNF PROVIDER<
AAF">AAF</option>
               
<option value="
VNF HEAT ORCHESTRATION TEMPLATE">VNF HEAT ORCHESTRATION TEMPLATE<
APPC">APPC</option>
               
<option value="
VNF PACKAGE">VNF PACKAGE<
CLAMP">CLAMP</option>
               <option value="
PNF
CCSDK"
>PNF<
>CCSDK</option>
               <option value="
VNF or PNF">VNF or PNF<
DCAE">DCAE</option>
              
</select>
 <option value="Documentation">Documentation</option>
               
</p>
<option value="DCAE">DCAE</option>
             
<p>
  <option value="External API">External API</option>
              
<label
 <option 
for
value="
introduced
Holmes"
>Introduced:<
>Holmes</
label>
option>
              
<select
 <option 
style
value="
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="introduced">
Integration">Integration</option>
               <option value="Logging">Logging</option>
               
<option value="
amsterdam">amsterdam<
Micro Bus">Micro Bus</option>
               
<option value="
beijing
Modeling"
>beijing<
>Modeling</option>
               
<option value="
casablanca">casablanca<
Multi VIM">Multi VIM</option>
               
<option value="
dublin
Music"
>dublin<
>Music</option>
               
<option value="
el alto">el alto<
CLI">CLI</option>
              
</select>
 <option value="OOM">OOM</option>
            
</p>
   
<option value="OOF">OOF</option>
       
<p>
        
<label for="impacts">Impacts*:</label>
<option value="Usecase UI">Usecase UI</option>
      
<select
 
style="width:
 
100%;
 
margin:
 
8px
 
0;
 
box-sizing:
 
border-box;
 
padding:
 
12px 20px;" name
<option value="
impacts" size="10" multiple>
Policy">Policy</option>
               
<option value="
AAI
Portal"
>AAI<
>Portal</option>
               
<option value="
AAF
SDNC"
>AAF<
>SDNC</option>
               
<option value="
APPC
SDC"
>APPC<
>SDC</option>
               
<option value="
CLAMP
SO"
>CLAMP<
>SO</option>
               
<option value="
CCSDK
VFC"
>CCSDK<
>VFC</option>
               
<option value="
DCAE
VID"
>DCAE<
>VID</option>
               <option value="
Documentation
VNFSDK"
>Documentation<
>VNFSDK</option>
               
<option value="
DCAE
VNFRQTS"
>DCAE<
>VNFRQTS</option>
               
<option value="
ExternalAPI
VVP"
>External API<
>VVP</option>
              </select>
   
<option value="Holmes">Holmes</option>
         </p>
            <p>
    
<option
 
value="Integration">Integration</option>
         <b>*Hold down the Ctrl (windows) / Command 
<option value="Logging">Logging</option>
(Mac) button to select multiple options for impacts.</b>
          
<option
 
value="MicroBus">Micro Bus</option>
 </p>
            
<option value="Modeling">Modeling</option>
<p>
              <label 
<option value
for="
MultiVIM
validation_mode"
>Multi
>Validation 
VIM<
Mode:</
option>
label>
              <select 
<option value
style="
Music">Music</option> <option value="CLI">CLI</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
               
<option value="
OOM">OOM<
" selected disabled hidden>Select Validation Mode</option>
               <option value="
OOF
static"
>OOF<
>static</option>
               <option value="
UsecaseUI
none"
>Usecase UI<
>none</option>
              </select>
   
<option
 
value="Policy">Policy</option>
        </p>
        
<option value="Portal">Portal</option>
    <p>
              
<option
<label 
value
for="
SDNC">SDNC</option>
requirementText">Requirement Text:*</label>
              <textarea 
<option value
style="
SDC">SDC</option> <option value="SO">SO</option>
width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" id="requirementText" rows="10" cols="30" class="required" value="" type="text"></textarea>
            </p>
    
<option
 
value="VFC">VFC</option>
       <p>
         
<option
 
value="VID">VID</option>
    <b>*Make sure to add keyword entered in KEYWORD field in the requirement 
<option value="VNFSDK">VNFSDK</option>
in CAPS.</b>
            
<option value="VNFRQTS">VNFRQTS</option>
</p>
          </fieldset>
       
<option value="VVP">VVP</option>
 </div>
      
</div>
    </
select>
form>
    <button style="background-color: #008CBA; color: white; border: 2px 
</p>
solid black; width: 100%; font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button>
    
<p> *Hold down the Ctrl (windows) / Command (Mac) button to select multiple options for impacts.
<textarea style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" rows="10" cols="30" id="formatted" readonly>
Formatted RST will Show here.
</textarea>

    <script>
      //define template
      var template = $('#sections .section:first').clone();
  
</p>
    //define counter
      var sectionsCount = 1;
   
<p>
   var url = "https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      $('body').on('click', 
<label for="validation_mode">Validation Mode:</label>
'#generate', function(e) {
        myFunction();
      
<select style="width: 100%; margin: 8px 0; box-sizing: border-box; padding: 12px 20px;" name="validation_mode">
});

      function myFunction() {
        get(url).then(JSON.parse).then(function(data) {
       
<option value="static">static</option>
   console.log("It worked!", data);
          return data;
       
<option value="none">none</option>
 }).catch(function(err) {
          // Instead, 
</select>
this happens:
          console.log("It 
</p>
failed!", err);
        }).then(function(data) {
          
<p>
var parsedData = parseIDs(data);
          var 
<label
finalIDs 
for="requirementText">Requirement Text:*</label>
= createIDs(1, parsedData);
          console.log(finalIDs);
    
<textarea
 
style="width:
 
100%;
 
margin:
 
8px
 
0; box-sizing: border-box; padding: 12px 20px;" name="requirementText" id="requirementText" rows="10" cols="30" value="" type="text">Enter Requirement text.</textarea>
 addSection(finalIDs);
        })
      }

      function 
</p>
get(url) {
        // 
</fieldset>
Return a new promise.
        return new Promise(function(resolve, reject) 
</div>
{
      
</div>
    
<
//
form>
 Do the usual 
<button style="background-color: #008CBA; color: white; border: 2px solid black; width: 100%; font-size: 24px;" onclick="formDataToObject(document.getElementById('req'))">Convert to RST</button>
XHR stuff
          var req = new XMLHttpRequest();
    
<textarea
 
style="width:
 
100%;
 
margin:
 
8px
 
0; box-sizing: border-box; padding: 12px 20px;" rows="10" cols="30" id="demo" readonly> Formatted RST will Show here. </textarea> <script>
 req.open('GET', url);
          req.onload = function() {
            //
define template var template = $('#sections .section:first').clone();
 This is called even on 404 etc
            //
define counter
 so check the status
       
var
 
sectionsCount
 
=
 
1;
  if (req.status == 200) 
var
{
  
url
 
=
 
"https://wiki.onap.org/download/attachments/60887371/needs.json?api=v2"
      
$('body').on('click',
 
'#generate',
 
function(e)
 
{
 // Resolve the promise with the response 
myFunction();
text
      
});
      
$('body').on('click',
 
'#convert',
 
function
resolve(
e) {
req.response);
        
convert();
    } else 
});
{
      
function
 
myFunction()
 
{
      // 
get(url).then(JSON.parse).then(function(data) {
Otherwise reject with the status text
           
console.log("It worked!", data);
   // which will hopefully be a meaningful error
     
return
 
data;
        
}).catch(function(err) {
reject(Error(req.statusText));
          
//
 
Instead, this happens:
 }
        
console.log("It failed!", err)
  };
          // 
}).then(function(data) {
Handle network errors
          
var
req.onerror 
parsedData
= 
parseIDs
function(
data
)
;
 {
          
var
 
finalIDs = createIDs(1, parsedData
 reject(Error("Network Error"));
          
console.log(finalIDs)
};
          
alert(finalIDs);
// Make the request
          
addSection
req.send(
finalIDs
);
        });
      }

      function 
get
parseIDs(
url
jsonText) {
        
//
var 
Return
result 
a
= new 
promise.
Set();
        
return
var 
new Promise(function(resolve, reject) {
version = jsonText.current_version;
        result.add(Object.keys(jsonText["versions"][version]["needs"]));
   
//
 
Do
 
the
 
usual
 
XHR stuff
 console.log(result);
        return result;
  
var
 
req
 
=
 
new XMLHttpRequest();
 }

      
req.open('GET', url);
function createIDs(numberOfIDs, parsedData) {
        var addedIDs = [];
  
req.onload
 
=
 
function()
 
{
   for (x = 0; x < numberOfIDs; x++) {
 
//
 
This
 
is
 
called
 
even
 
on
 
404
 
etc
  var new_id = "";
       
//
 
so
 
check
 
the
do 
status
{
            
if (req.status == 200) {
new_id = (Math.floor(Math.random() * 999999));
            if 
// Resolve the promise with the response text
(new_id < 100000) {
              new_id = ('000000' 
resolve(req.response
+ new_id).slice(-6);
            }
else {

            new_id 
// Otherwise reject with the status text
= ("R-" + new_id);
          
// which will hopefully be a meaningful error
}
          while 
reject(Error(req.statusText
(parsedData.has(new_id));
          addedIDs[x] 
}
= new_id;
        
}
;

        
// Handle network errors
return addedIDs;
      }

    
req.onerror
 
=
 function addSection(finalIDs) {
        document.getElementById('id').value = finalIDs;
   
reject(Error("Network
 
Error"));
  }

      function 
};
formDataToObject(elForm) {
        
//if 
Make the request
(!elForm instanceof Element) return;
        var fields = 
req
elForm.
send();
querySelectorAll('input, select, textarea'),
        
});
  o = {};
  
}
      
function
for 
parseIDs
(
jsonText)
var 
{
i = 0, imax = fields.length; i < 
var result = new Set();
imax; ++i) {
          var 
version
field = 
jsonText.current_version;
fields[i],
        
result.add(Object.keys(jsonText["versions"][version]["needs"]));
    sKey = field.name || 
console.log(result)
field.id;
        
return
 
result;
 if (field.type === 'button' 
} function createIDs(numberOfIDs, parsedData) {
|| field.type === 'image' || field.type === 'submit' || !sKey) continue;
        
var
  
addedIDs = [];
switch (field.type) {
        
for
 
(x
 
=
 
0;
 
x < numberOfIDs; x++) {
case 'checkbox':
             
var new_id
 o[sKey] = 
""
+field.checked;
          
do
 
{
   break;
         
new_id
 
=
 
(Math.floor(Math.random() * 999999));
 case 'radio':
              if (
new_id < 100000) {
o[sKey] === undefined) o[sKey] = '';
              
new_id = ('000000' + new_id).slice(-6);
if (field.checked) o[sKey] = field.value;
              
}
break;
            
new_id = ("R-" + new_id);
case 'select-multiple':
        
}
      var a 
while (parsedData.has(new_id))
= [];
          
addedIDs[x]
 
=
 
new_id;
  
} return addedIDs;
for (var j = 0, jmax = field.options.length; j < jmax; ++j) {
    
}
      
function
 
addSection(finalIDs)
 
{
    if 
document.getElementById('id').value = finalIDs;
(field.options[j].selected) a.push(field.options[j].value);
        
}
      
function formDataToObject(elForm) {
}
            
//if
 
(!elForm instanceof Element) return
 o[sKey] = a;
        
var
  
fields
 
=
 
elForm.querySelectorAll('input,
 
select, textarea'),
 break;
          
o
 
=
 
{};
default:
        
for
  
(var
 
i
 
=
 
0, imax
 o[sKey] = 
fields
field.
length
value;
 
i
 
<
 
imax;
 
++i)
 
{
     }
     
var
 
field
 
=
 
fields[i],
}
        //formcheck();
    
sKey
 
=
 
field.name
 
|| field.id
 buildRST(o);
        return 
if (field.type === 'button' || field.type === 'image' || field.type === 'submit' || !sKey) continue;
o;
      }

      function buildRST(o) {
        var rst 
switch
= 
(field
"..
type) {
 req::\n";
        var arrayOfLines 
case 'checkbox':
= $('#requirementText').val().split('\n');
        for (y in o) {
      
o[sKey]
 
=
 
+field.checked;
  if (y == "requirementText") {
        
break;
    for (z in arrayOfLines) {
    
case
 
'radio':
         rst += "\n   
if
 
(o[sKey] === undefined) o[sKey] = ''
" + arrayOfLines[z];
            
if (field.checked) o[sKey] = field.value;
}
          } else {
 
break;
           rst 
case 'select-multiple':
+= "    :" + y + ": " + o[y] + 
var a = [];
"\n";
          }
        }
 
for
 
(var
 
j
 
=
 
0,
 
jmax
 
=
 
field.options.length; j < jmax; ++j) {
document.getElementById("formatted").innerHTML = rst;
      }

      function formcheck() {
        var l 
if
= $(
field.options[j].selected) a.push(field.options[j].value)
".required").length;
        var result 
}
= [];
        for (i = 0; i 
o[sKey] = a;
< l; i++) {
          //Push each element to the 
break;
array
          if 
default:
($('.required').eq(i).val() == "") {
            
o[sKey] = field.value
result.push($('.required')[i].name);
          }
        }
        if 
buildRST(o);
(result.length != 0) {
     
return
 
o;
    
} function buildRST(o) {
alert("Please enter a value in: " + result);
        
var
}
 
rst
 
=
 
"..req::\n\n";
   }

     
var
 
arrayOfLines
function 
= $('#requirementText').val().split('\n')
buildReq(fieldClicked) {
        
for
var 
(y in o) {
addedTarget, addedKeword;
        var text 
if
= 
(y == "requirementText") {
$('#requirementText');
        switch (fieldClicked.id) {
     
for
 
(z
 
in
 
arrayOfLines)
 
{
 case 'target':
            
rst
addedTarget 
+
= 
"\n
'The ' + fieldClicked.value 
"
+ 
+ arrayOfLines[z]
' ';
           
}
 text.val(text.val() + addedTarget);
          
}
 
else
 
{
break;
          case 'keyword':
 
rst
 
+=
 
"
    
:"
 
+
 
y
 
+
 
": " + o[y] + "\n"
 text.val(text.val() + fieldClicked.value);
          
}
  
}
break;
        
document.getElementById("demo").innerHTML = rst;
}
      }

    </script>
  </body>

</html>