Best Python code snippet using toolium_python
config_app_routes.py
Source:config_app_routes.py  
1# -*- encoding: utf-8 -*-2from . import version3### ROUTES / PAGES4default_routes_config = [5  ### - - - - - - - - - - - - - - - - - ###6  ### PAGES : HOME --> NEED AT LEAST ONE ROUTE AS 'is_global_app_homepage = True' / TO BE ADDED VIA BACK OFFICE BY ADMIN USER7  ### - - - - - - - - - - - - - - - - - ###8  { "field"             : "app_home_fr",9    "is_global_app_homepage" : True,10    "route_title"       : u"Home",11    "route_description" : u"apiviz default home page",12    "route_activated"   : True,13    "banner" : {14      "activated"  : False,15      "banner_uri" : "banner-sonum-carto"16    },17    "in_main_navbar"    : False,18    "navbar_btn_options" : {19      "position"   : "middle_left",20      "link_type"  : "link",21      "icon_class" : "",22      "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],23      "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],24    },25    "in_footer"         : False,26    "link_in_logo"      : True,27    "urls"              : ["/"],28    # "template_url"      : "https://raw.githubusercontent.com/co-demos/carto-sonum/master/pages-html/test-apiviz.html",29    "template_url"      : "https://raw.githubusercontent.com/CBalsier/test-content/master/pages-html/home.html",30    "help"              : u"you can specify a remote template (f.e. a github url)",31    "languages"         : ["fr"],32      "app_version"       : version,33    "comment"           : u"Main home route in french",34    "is_dynamic"        : True,35    "dynamic_template"  : "DynamicStatic",36    "has_navbar"        : True,37    "has_footer"        : True,38      "is_default"        : True39  },40  ### - - - - - - - - - - - - - - - - - ###41  ### PAGES : DATASETS --> TO BE ADDED VIA BACK OFFICE BY ADMIN USER42  ### - - - - - - - - - - - - - - - - - ###43  ### DATASETS CARTO SONUM44    ### PAGE PROJECT45    { "field"             : "sonum_carto_project",46      "is_global_app_homepage" : True,47      "route_title"       : u"Home",48      "route_description" : u"apiviz default home page",49      "route_activated"   : True,50      "banner" : {51        "activated"  : False,52        "banner_uri" : "banner-sonum-carto"53      },54      "in_main_navbar"    : False,55      "navbar_btn_options" : {56        "position"   : "middle_right",57        "link_type"  : "link",58        "icon_class" : "",59        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],60        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],61      },62      "in_footer"         : False,63      "link_in_logo"      : True,64      "urls"              : ["/sonum-carto/projet"],65      "template_url"      : "https://raw.githubusercontent.com/co-demos/carto-sonum/master/pages-html/sonum-carto-projet.html",66      "help"              : u"you can specify a remote template (f.e. a github url)",67      "languages"         : ["fr"],68        "app_version"       : version,69      "comment"           : u"Main project route in french",70      "is_dynamic"        : True,71      "dynamic_template"  : "DynamicStatic",72      "has_navbar"        : True,73      "has_footer"        : True,74        "is_default"        : True75    },76    ## PAGE - map77    { "field"             : "sonum_carto_carte",78      "is_global_app_homepage" : False,79      "route_title"       : u"Rechercher",80      "route_description" : u"Page de recherche d'Apiviz",81      "route_activated"   : True,82      "banner" : {83        "activated"  : True,84        "banner_uri" : "banner-sonum-carto"85      },86      "is_dataset_homepage" : True,87      "in_main_navbar"    : True,88      "navbar_btn_options" : {89        "only_in_navbar_for_this_dataset" : False,90        "position"   : "middle_right",91        "link_type"  : "link",92        "icon_class" : "",93        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],94        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],95      },96      "in_footer"         : False,97      "urls"              : ["/sonum-carto/carte"],98      "template_url"      : "/static/spa.html",99      "help"             : u"you can specify a remote template (f.e. a github url)",100      "languages"         : ["fr"],101        "app_version"        : version,102      "comment"           : u"Main search route in french",103      "is_dynamic"        : True,104      "dataset_uri"        : "sonum-carto",105      "dynamic_template"  : 'DynamicMap',106      "endpoint_type"     : "map",107      "contents_fields"  : [108        { "field" : "sd_id",109          "is_visible" : True,110          "position" : "block_id",111          "trim" : 50,112          "locale" : "fr"113        },114        { "field" : "adresse structure",115          "is_visible" : True,116          "position" : "block_address",117          "trim" : 20,118          "locale" : "fr"119        },120        { "field" : "ville structure",121          "is_visible" : True,122          "position" : "block_city",123          "trim" : 20,124          "locale" : "fr"125        },126        { "field" : "intitulé structure",127          "is_visible" : True,128          "position" : "block_title",129          "trim" : 20,130          "locale" : "fr"131        },132        { "field" : "",133          "is_visible" : True,134          "position" : "block_image",135          "trim" : 20,136          "locale" : "fr"137        },138        { "field" : "description structure",139          "is_visible" : True,140          "position" : "block_abstract",141          "trim" : 50,142          "locale" : "fr"143        },144        { "field" : "source",145          "is_visible" : True,146          "position" : "block_src",147          "trim" : 50,148          "locale" : "fr"149        },150        { "field" : "",151          "is_visible" : True,152          "position" : "block_tags",153          "trim" : 50,154          "locale" : "fr"155         },156      ],157      "lat_long_fields" : {158        "latitude" : "lat",159        "longitude" : "lon"160      },161      "images_fields"        : {162        "card_img_main" : { "field" : "", "default" : "img_card",  "is_visible" : True  },163        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },164      },165      "ui_options"        : {166        "card_color"    : { "value" : None, "default" : "white", },167        "text_color"    : { "value" : None, "default" : "black", },168        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },169        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },170        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },171      },172      "links_options"  : {173        "block_contents_links" : {174         "is_visible"  : False,175         "position"    : "block_bottom_1",176         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],177         "links"       : []178        },179        "block_data_infos" : {180         "is_visible"  : False,181         "position"    : "block_bottom_2",182         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],183         "links"       : []184        },185        "block_share" : {186         "is_visible"  : False,187         "position"    : "block_bottom_3",188         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],189         "links"       : []190        },191      },192      "has_navbar"        : True,193      "has_footer"        : True,194      "deactivate_btn"    : False,195      "is_visible"        : True,196        "is_default"      : True197    },198    ## PAGE - list199    { "field"             : "sonum_carto_liste",200      "is_global_app_homepage" : False,201      "route_title"       : u"Rechercher",202      "route_description" : u"Page de recherche d'Apiviz",203      "route_activated"   : True,204      "banner" : {205        "activated"  : False,206        "banner_uri" : "banner-sonum-carto"207      },208      "is_dataset_homepage" : False,209      "in_main_navbar"    : False,210      "navbar_btn_options" : {211        "only_in_navbar_for_this_dataset" : True,212        "position"   : "middle_right",213        "link_type"  : "link",214        "icon_class" : "",215        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],216        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],217      },218      "in_footer"         : False,219      "urls"              : ["/sonum-carto/liste"],220      "template_url"      : "/static/spa.html",221      "help"             : u"you can specify a remote template (f.e. a github url)",222      "languages"         : ["fr"],223        "app_version"        : version,224      "comment"           : u"Main search route in french",225      "is_dynamic"        : True,226      "dataset_uri"        : "sonum-carto",227      "dynamic_template"  : 'DynamicList',228      "endpoint_type"     : "list",229      "contents_fields"  : [230        { "field" : "sd_id",231          "is_visible" : True,232          "position" : "block_id",233          "trim" : 50,234          "locale" : "fr"235        },236        { "field" : "adresse structure",237          "is_visible" : True,238          "position" : "block_address",239          "trim" : 20,240          "locale" : "fr"241        },242        { "field" : "ville structure",243          "is_visible" : True,244          "position" : "block_city",245          "trim" : 20,246          "locale" : "fr"247        },248        { "field" : "intitulé structure",249          "is_visible" : True,250          "position" : "block_title",251          "trim" : 20,252          "locale" : "fr"253        },254        { "field" : "",255          "is_visible" : True,256          "position" : "block_image",257          "trim" : 20,258          "locale" : "fr"259        },260        { "field" : "description structure",261          "is_visible" : True,262          "position" : "block_abstract",263          "trim" : 50,264          "locale" : "fr"265        },266        { "field" : "source",267          "is_visible" : True,268          "position" : "block_src",269          "trim" : 50,270          "locale" : "fr"271        },272        { "field" : "",273          "is_visible" : True,274          "position" : "block_tags",275          "trim" : 50,276          "locale" : "fr"277         },278      ],279      "images_fields"        : {280        "card_img_main" : { "field" : "", "default" : "img_card",  "is_visible" : True  },281        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },282      },283      "ui_options" : {284        "card_color"    : { "value" : None, "default" : "white", },285        "text_color"    : { "value" : None, "default" : "black", },286        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },287        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },288        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },289      },290      "links_options"  : {291        "block_contents_links" : {292         "is_visible"  : False,293         "position"    : "block_bottom_1",294         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],295         "links"       : []296        },297        "block_data_infos" : {298         "is_visible"  : False,299         "position"    : "block_bottom_2",300         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],301         "links"       : []302        },303        "block_share" : {304         "is_visible"  : False,305         "position"    : "block_bottom_3",306         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : False}],307         "links"       : []308        },309      },310      "has_navbar"        : True,311      "has_footer"        : True,312      "deactivate_btn"    : False,313      "is_visible"        : True,314        "is_default"        : True315    },316    ## PAGE - detail317    { "field"             : "sonum_carto_detail",318      "is_global_app_homepage" : False,319      "route_title"        : u"Rechercher",320      "route_description"  : u"Page de recherche d'Apiviz",321      "route_activated"    : True,322      "banner" : {323        "activated"  : False,324        "banner_uri" : "banner-sonum-carto"325      },326      "is_dataset_homepage" : False,327      "in_main_navbar"    : False,328      "navbar_btn_options" : {329        "only_in_navbar_for_this_dataset" : True,330        "position"   : "middle_right",331        "link_type"  : "link",332        "icon_class" : "",333        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],334        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],335      },336      "in_footer"         : False,337      "urls"              : ["/sonum-carto/detail"],338      "template_url"      : "/static/spa.html",339      "help"              : u"you can specify a remote template (f.e. a github url)",340      "languages"         : ["fr"],341        "app_version"        : version,342      "comment"           : u"Main search route in french",343      "is_dynamic"        : True,344      "dataset_uri"        : "sonum-carto",345      "dynamic_template"  : 'DynamicDetail',346      "endpoint_type"     : "detail",347      "contents_fields"  : [348        { "field" : "intitulé structure",349          "is_visible" : True,350          "position" : "block_title",351          "trim" : 0,352          "locale" : "fr"353        },354        { "field" : "adresse structure",355          "is_visible" : True,356          "position" : "block_address",357          "trim" : 0,358          "locale" : "fr"359        },360       { "field" : "code postal structure",361          "is_visible" : True,362          "position" : "block_cp",363          "trim" : 0,364          "locale" : "fr"365        },366        { "field" : "description structure",367          "is_visible" : True,368          "position" : "block_abstract",369          "trim" : 0,370          "locale" : "fr"371        },372        { "field" : "source",373          "is_visible" : False,374          "position" : "block_src",375          "trim" : 0,376          "locale" : "fr"377        },378        { "field" : "services",379          "is_visible" : True,380          "position" : "block_tags",381          "trim" : 0,382          "locale" : "fr"383        },384        { "field" : "website structure",385          "is_visible" : True,386          "position" : "block_wesite",387          "trim" : 0,388          "locale" : "fr"389        },390        { "field" : "contact",391          "is_visible" : True,392          "position" : "block_contact",393          "trim" : 0,394          "locale" : "fr"395        },396        { "field" : "téléphone",397          "is_visible" : True,398          "position" : "block_tel",399          "trim" : 0,400          "locale" : "fr"401        },402        { "field" : "horaires structure",403          "is_visible" : True,404          "position" : "block_open_infos",405          "trim" : 0,406          "locale" : "fr"407        },408        { "field" : "services",409          "is_visible" : True,410          "position" : "block_services",411          "title_block" : [{ "locale" : "fr", "text" : "Services proposés", "is_visible" : False }],412        },413        { "field" : "infos pratiques",414          "is_visible" : True,415          "position" : "block_infos_pract",416          "title_block" : [{ "locale" : "fr", "text" : "Informations pratiques", "is_visible" : False }],417        },418      ],419      "images_fields"     : {420        "card_img_main"  : { "field" : "", "default" : "img_card",  "is_visible" : True,  "position" : "block_right_top_1" },421        "card_img_top"   : { "field" : "", "default" : None,        "is_visible" : False, "position" : "block_right_middle" },422      },423      "ui_options"        : {424        "card_color"     : { "value" : None, "default" : "white", },425        "text_color"     : { "value" : None, "default" : "black", },426        "link_to_detail"   : { "is_visible" : False, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },427        "link_to_next"     : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },428        "link_to_previous" : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },429      },430      "links_options"  : {431        "block_contents_links" : {432         "is_visible"  : True,433         "position"    : "block_left_middle_2",434         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],435         "links"       : [436           { "field" : "website",437             "is_visible" : True,438             "link_type"  : "text",439             "icon_class" : "",440             "link_text"  : [{"locale" : "fr", "text" : "website" }],441             "tooltip"    : [{"locale" : "fr", "text" : "voir le site" }]442           },443           { "field" : "contact",444             "is_visible" : True,445             "link_type"  : "text",446             "icon_class" : "",447             "link_text"  : [{"locale" : "fr", "text" : "contact" }],448             "tooltip"    : [{"locale" : "fr", "text" : "contacter la structure" }]449           },450         ]451        },452        "block_share" : {453         "is_visible"  : True,454         "position"    : "block_left_bottom_2",455         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : True}],456         "links"       : [457           {458             "is_visible" : True,459             "link_type"  : "icon",460             "icon_class" : "fas fa-link",461             "link_text"  : [{"locale" : "fr", "text" : "lien" }],462             "tooltip"    : [{"locale" : "fr", "text" : "partager cette page (copier le lien)" }]463           },464          {465             "is_visible" : True,466             "link_type"  : "icon",467             "icon_class" : "fab fa-facebook-f",468             "link_text"  : [{"locale" : "fr", "text" : "facebook" }],469             "tooltip"    : [{"locale" : "fr", "text" : "partager sur facebook" }]470           },471           {472             "is_visible" : True,473             "link_type"  : "icon",474             "icon_class" : "fab fa-twitter",475             "link_text"  : [{"locale" : "fr", "text" : "twitter" }],476             "tooltip"    : [{"locale" : "fr", "text" : "partager sur twitter" }]477           },478         ]479        },480      },481      "has_navbar"        : True,482      "has_footer"        : True,483      "deactivate_btn"    : False,484      "is_visible"        : True,485        "is_default"        : True486    },487  ### DATASETS XP SONUM488    ## PAGE - map489    { "field"             : "sonum_xp_carte",490      "is_global_app_homepage" : False,491      "route_title"        : u"Rechercher",492      "route_description"  : u"Page de recherche d'Apiviz",493      "route_activated"    : True,494      "banner" : {495        "activated"  : False,496        "banner_uri" : "banner-sonum-xp"497      },498      "is_dataset_homepage" : False,499      "in_main_navbar"    : False,500      "navbar_btn_options" : {501        "only_in_navbar_for_this_dataset" : True,502        "position"   : "middle_right",503        "link_type"  : "link",504        "icon_class" : "",505        "link_text"  : [{"locale" : "fr", "text" : "Recherher une expérience" }],506        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],507      },508      "in_footer"         : False,509      "urls"              : ["/sonum-xp/carte"],510      "template_url"      : "/static/spa.html",511      "help"              : u"you can specify a remote template (f.e. a github url)",512      "languages"         : ["fr"],513        "app_version"        : version,514      "comment"           : u"Main search route in french",515      "is_dynamic"        : True,516      "dataset_uri"       : "sonum-xp",517      "dynamic_template"  : 'DynamicMap',518      "endpoint_type"     : "map",519      "contents_fields"  : [520        { "field" : "sd_id",521          "is_visible" : True,522          "position" : "block_id",523          "trim" : 50,524          "locale" : "fr"525        },526        { "field" : "titre initiative",527          "is_visible" : True,528          "position" : "block_title",529          "trim" : 50,530          "locale" : "fr"531        },532        { "field" : "adresse structure",533          "is_visible" : True,534          "position" : "block_address",535          "trim" : 20,536          "locale" : "fr"537        },538        { "field" : "city",539          "is_visible" : True,540          "position" : "block_city",541          "trim" : 20,542          "locale" : "fr"543        },544        { "field" : "présentation initiative",545          "is_visible" : True,546          "position" : "block_abstract",547          "trim" : 50,548          "locale" : "fr"549        },550        { "field" : "type structure",551          "is_visible" : True,552          "position" : "block_tags",553          "trim" : 50,554          "locale" : "fr"555         },556      ],557      "images_fields"        : {558        "card_img_main" : { "field" : "", "default" : "img_card",  "is_visible" : True  },559        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },560      },561      "ui_options"        : {562        "card_color"    : { "value" : None, "default" : "white", },563        "text_color"    : { "value" : None, "default" : "black", },564        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },565        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },566        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },567      },568      "links_options"  : {569        "block_contents_links" : {570         "is_visible"  : False,571         "position"    : "block_bottom_1",572         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],573         "links"       : []574        },575        "block_data_infos" : {576         "is_visible"  : False,577         "position"    : "block_bottom_2",578         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],579         "links"       : []580        },581        "block_share" : {582         "is_visible"  : False,583         "position"    : "block_bottom_3",584         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],585         "links"       : []586        },587      },588      "has_navbar"        : True,589      "has_footer"        : True,590      "deactivate_btn"    : False,591      "is_visible"        : True,592        "is_default"        : True593    },594    ## PAGE - list595    { "field"             : "sonum_xp_liste",596      "is_global_app_homepage" : False,597      "route_title"        : u"Rechercher",598      "route_description"  : u"Page de recherche d'Apiviz",599      "route_activated"    : True,600      "banner" : {601        "activated"  : True,602        "banner_uri" : "banner-sonum-xp"603      },604      "is_dataset_homepage" : True,605      "in_main_navbar"    : True,606      "navbar_btn_options" : {607        "only_in_navbar_for_this_dataset" : False,608        "position"   : "middle_right",609        "link_type"  : "link",610        "icon_class" : "",611        "link_text"  : [{"locale" : "fr", "text" : "Recherher une expérience" }],612        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],613      },614      "in_footer"         : False,615      "urls"              : ["/sonum-xp/liste"],616      "template_url"      : "/static/spa.html",617      "help"              : u"you can specify a remote template (f.e. a github url)",618      "languages"         : ["fr"],619        "app_version"        : version,620      "comment"           : u"Main search route in french",621      "is_dynamic"        : True,622      "dataset_uri"       : "sonum-xp",623      "dynamic_template"  : 'DynamicList',624      "endpoint_type"     : "list",625      "contents_fields"  : [626        { "field" : "sd_id",627          "is_visible" : True,628          "position" : "block_id",629          "trim" : 50,630          "locale" : "fr"631        },632        { "field" : "titre initiative",633          "is_visible" : True,634          "position" : "block_title",635          "trim" : 50,636          "locale" : "fr"637        },638        { "field" : "adresse structure",639          "is_visible" : True,640          "position" : "block_address",641          "trim" : 20,642          "locale" : "fr"643        },644        { "field" : "city",645          "is_visible" : True,646          "position" : "block_city",647          "trim" : 20,648          "locale" : "fr"649        },650        { "field" : "présentation initiative",651          "is_visible" : True,652          "position" : "block_abstract",653          "trim" : 50,654          "locale" : "fr"655        },656        { "field" : "type structure",657          "is_visible" : True,658          "position" : "block_tags",659          "trim" : 50,660          "locale" : "fr"661         },662      ],663      "images_fields"        : {664        "card_img_main" : { "field" : "illustration initiative", "default" : "img_card",  "is_visible" : True  },665        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },666      },667      "ui_options" : {668        "card_color"    : { "value" : None, "default" : "white", },669        "text_color"    : { "value" : None, "default" : "black", },670        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },671        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },672        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },673      },674      "links_options"  : {675        "block_contents_links" : {676         "is_visible"  : False,677         "position"    : "block_bottom_1",678         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],679         "links"       : []680        },681        "block_data_infos" : {682         "is_visible"  : False,683         "position"    : "block_bottom_2",684         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],685         "links"       : []686        },687        "block_share" : {688         "is_visible"  : False,689         "position"    : "block_bottom_3",690         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : False}],691         "links"       : []692        },693      },694      "has_navbar"        : True,695      "has_footer"        : True,696      "deactivate_btn"    : False,697      "is_visible"        : True,698        "is_default"        : True699    },700    ## PAGE - detail701    { "field"               : "sonum_xp_detail",702      "is_global_app_homepage" : False,703      "route_title"         : u"Rechercher",704      "route_description"   : u"Page de recherche d'Apiviz",705      "route_activated"     : True,706      "is_dataset_homepage" : False,707      "banner" : {708        "activated"  : False,709        "banner_uri" : "banner-sonum-xp"710      },711      "in_main_navbar"    : False,712      "navbar_btn_options" : {713        "only_in_navbar_for_this_dataset" : True,714        "position"   : "middle_right",715        "link_type"  : "link",716        "icon_class" : "",717        "link_text"  : [{"locale" : "fr", "text" : "Recherher une expérience" }],718        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],719      },720      "in_footer"         : False,721      "urls"              : ["/sonum-xp/detail"],722      "template_url"      : "/static/spa.html",723      "help"              : u"you can specify a remote template (f.e. a github url)",724      "languages"         : ["fr"],725        "app_version"        : version,726      "comment"           : u"Main search route in french",727      "is_dynamic"        : True,728      "dataset_uri"       : "sonum-xp",729      "dynamic_template"  : 'DynamicDetail',730      "endpoint_type"     : "detail",731      "contents_fields"  : [732        { "field" : "titre initiative",733          "is_visible" : True,734          "position" : "block_title",735          "trim" : 50,736          "locale" : "fr"737        },738        { "field" : "public visé",739          "is_visible" : True,740          "position" : "block_main_tags",741          "custom_title" : "Publics visés :",742          "is_tag_like" : True,743          "tags_separator" : "-",744          "trim" : 20,745          "locale" : "fr"746        },747        { "field" : "échelle action initiative",748          "is_visible" : True,749          "position" : "block_scale_tags",750          "custom_title" : "Echelle :",751          "is_tag_like" : True,752          "tags_separator" : "-",753          "trim" : 20,754          "locale" : "fr"755        },756        { "field" : "nom structure porteuse",757          "is_visible" : True,758          "position" : "block_scale_2",759          "custom_title" : "Structure :",760          "trim" : 20,761          "locale" : "fr"762        },763        { "field" : "adresse structure",764          "is_visible" : True,765          "position" : "block_scale_address",766          "trim" : 20,767          "locale" : "fr"768        },769        { "field" : "city",770          "is_visible" : True,771          "position" : "block_city",772          "trim" : 20,773          "locale" : "fr"774        },775        { "field" : "présentation structure",776          "is_visible" : True,777          "position" : "block_pre_abstract",778          "custom_title" : "Présentation de la structure",779          "trim" : 50,780          "locale" : "fr"781        },782        { "field" : "présentation initiative",783          "is_visible" : True,784          "position" : "block_abstract",785          "custom_title" : "Présentation de l'initiative",786          "trim" : 50,787          "locale" : "fr"788        },789        { "field" : "type structure",790          "is_visible" : True,791          "position" : "block_tags",792          "trim" : 50,793          "locale" : "fr"794        },795        { "field" : "date action initiative - début",796          "is_visible" : True,797          "position" : "block_period",798          "trim" : 50,799          "locale" : "fr"800         },801        { "field" : "contact - nom",802          "is_visible" : True,803          "position" : "block_contact_surname",804          "trim" : 0,805          "locale" : "fr"806        },807        { "field" : "contact - prénom",808          "is_visible" : True,809          "position" : "block_contact_name",810          "trim" : 0,811          "locale" : "fr"812        },813        { "field" : "contact - titre",814          "is_visible" : True,815          "position" : "block_contact_title",816          "trim" : 0,817          "locale" : "fr"818        },819        { "field" : "contact - email",820          "is_visible" : True,821          "position" : "block_contact_email",822          "trim" : 0,823          "locale" : "fr"824        },825        { "field" : "contact - téléphone",826          "is_visible" : True,827          "position" : "block_contact_tel",828          "trim" : 0,829          "locale" : "fr"830        },831        { "field" : "lien document présentation",832          "is_visible" : True,833          "position" : "block_file_1",834          "trim" : 0,835          "locale" : "fr"836        },837        { "field" : "website - initiative",838          "is_visible" : True,839          "position" : "block_wesite",840          "trim" : 0,841          "locale" : "fr"842        },843        { "field" : "retour d'expérience",844          "is_visible" : True,845          "position" : "block_right_bottom_1",846          "trim" : 0,847          "custom_title" : "Retour d'expérience",848          "locale" : "fr"849        },850        { "field" : "partenaires initiative",851          "is_visible" : True,852          "position" : "block_post_abstract_1",853          "trim" : 0,854          "custom_title" : "Partenaires de l'initiative",855          "locale" : "fr"856        },857        { "field" : "moyens humains initiative",858          "is_visible" : True,859          "position" : "block_post_abstract_2",860          "trim" : 0,861          "custom_title" : "Moyens",862          "locale" : "fr"863        },864        { "field" : "mesure d'impact",865          "is_visible" : True,866          "position" : "block_right_bottom_2",867          "trim" : 0,868          "custom_title" : "Mesure d'impact",869          "locale" : "fr"870        },871      ],872      "images_fields"     : {873        "card_img_main"  : { "field" : "", "default" : "img_card",  "is_visible" : True,  "position" : "block_right_top_1" },874        "card_img_top"   : { "field" : "", "default" : None,        "is_visible" : False, "position" : "block_right_middle" },875      },876      "ui_options"        : {877        "card_color"     : { "value" : None, "default" : "white", },878        "text_color"     : { "value" : None, "default" : "black", },879        "link_to_detail"   : { "is_visible" : False, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },880        "link_to_next"     : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },881        "link_to_previous" : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },882      },883      "links_options"  : {884        "block_contents_links" : {885         "is_visible"  : True,886         "position"    : "block_left_middle_2",887         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],888         "links"       : [889           { "field" : "website",890             "is_visible" : True,891             "link_type"  : "text",892             "icon_class" : "",893             "link_text"  : [{"locale" : "fr", "text" : "website" }],894             "tooltip"    : [{"locale" : "fr", "text" : "voir le site" }]895           },896           { "field" : "contact",897             "is_visible" : True,898             "link_type"  : "text",899             "icon_class" : "",900             "link_text"  : [{"locale" : "fr", "text" : "contact" }],901             "tooltip"    : [{"locale" : "fr", "text" : "contacter la structure" }]902           },903         ]904        },905        "block_share" : {906         "is_visible"  : True,907         "position"    : "block_left_bottom_2",908         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : True}],909         "links"       : [910            {911              "is_visible" : True,912              "link_type"  : "icon",913              "icon_class" : "fas fa-link",914              "link_text"  : [{"locale" : "fr", "text" : "lien" }],915              "tooltip"    : [{"locale" : "fr", "text" : "partager cette page (copier le lien)" }]916            },917            {918              "is_visible" : True,919              "link_type"  : "icon",920              "icon_class" : "fab fa-facebook-f",921              "link_text"  : [{"locale" : "fr", "text" : "facebook" }],922              "tooltip"    : [{"locale" : "fr", "text" : "partager sur facebook" }]923            },924            {925              "is_visible" : True,926              "link_type"  : "icon",927              "icon_class" : "fab fa-twitter",928              "link_text"  : [{"locale" : "fr", "text" : "twitter" }],929              "tooltip"    : [{"locale" : "fr", "text" : "partager sur twitter" }]930            },931          ]932        },933      },934      "has_navbar"        : True,935      "has_footer"        : True,936      "deactivate_btn"    : False,937      "is_visible"        : True,938        "is_default"        : True939    },940    ### PAGE STRATEGIE941    { "field"             : "sonum_xp_strategie",942      "is_global_app_homepage" : True,943      "route_title"       : u"Stratégie XP",944      "route_description" : u"apiviz default home page",945      "route_activated"   : True,946      "banner" : {947        "activated"  : False,948        "banner_uri" : "banner-sonum-xp"949      },950      "in_main_navbar"    : False,951      "navbar_btn_options" : {952        "position"   : "middle_right",953        "link_type"  : "link",954        "icon_class" : "",955        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],956        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],957      },958      "in_footer"         : False,959      "link_in_logo"      : True,960      "urls"              : ["/sonum-xp/stratégie"],961      "template_url"      : "https://raw.githubusercontent.com/co-demos/xp-sonum/master/pages-html/strategie-clean.html",962      "help"              : u"you can specify a remote template (f.e. a github url)",963      "languages"         : ["fr"],964        "app_version"       : version,965      "comment"           : u"Main project route in french",966      "is_dynamic"        : True,967      "dynamic_template"  : "DynamicStatic",968      "has_navbar"        : True,969      "has_footer"        : True,970        "is_default"        : True971    },972### DATASET CIS973    ### PAGE PROJECT974  { "field"             : "cis_project",975    "is_global_app_homepage" : True,976    "route_title"       : u"Home",977    "route_description" : u"apiviz default home page",978    "route_activated"   : True,979    "banner" : {980      "activated"  : False,981      "banner_uri" : "banner-sonum-carto"982    },983    "in_main_navbar"    : False,984    "navbar_btn_options" : {985      "position"   : "middle_right",986      "link_type"  : "link",987      "icon_class" : "",988      "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],989      "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],990    },991    "in_footer"         : False,992    "link_in_logo"      : True,993    "urls"              : ["/le-projet"],994    # "template_url"      : "/static/le-projet.html",995    "template_url"      : "https://raw.githubusercontent.com/CBalsier/test-content/master/pages-html/le-projet.html",996    "help"              : u"you can specify a remote template (f.e. a github url)",997    "languages"         : ["fr"],998      "app_version"       : version,999    "comment"           : u"Main project route in french",1000    "is_dynamic"        : True,1001    "dynamic_template"  : "DynamicStatic",1002    "has_navbar"        : True,1003    "has_footer"        : True,1004      "is_default"        : True1005  },1006    ### PAGE - map1007    { "field"             : "cis_carte",1008      "is_global_app_homepage" : False,1009      "route_title"       : u"Rechercher",1010      "route_description" : u"Page de recherche d'Apiviz",1011      "route_activated"   : True,1012      "banner" : {1013        "activated"  : False,1014        "banner_uri" : "banner-sonum-carto" # TODO1015      },1016      "is_dataset_homepage" : True,1017      "in_main_navbar"    : True,1018      "navbar_btn_options" : {1019        "only_in_navbar_for_this_dataset" : False,1020        "position"   : "middle_right",1021        "link_type"  : "link",1022        "icon_class" : "",1023        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1024        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1025      },1026      "in_footer"         : False,1027      "urls"              : ["/recherche/carte"],1028      "template_url"      : "/static/spa.html",1029      "help"             : u"you can specify a remote template (f.e. a github url)",1030      "languages"         : ["fr"],1031        "app_version"        : version,1032      "comment"           : u"Main search route in french",1033      "is_dynamic"        : True,1034      "dataset_uri"        : "cis",1035      "dynamic_template"  : 'DynamicMap',1036      "endpoint_type"     : "map",1037      "contents_fields"  : [1038        { "field" : "sd_id",1039          "is_visible" : True,1040          "position" : "block_id",1041          "trim" : 50,1042          "locale" : "fr"1043        },1044        # { "field" : "adresse structure", # SONUM1045        { "field" : "adresse du projet", # CIS1046          "is_visible" : True,1047          "position" : "block_address",1048          "trim" : 20,1049          "locale" : "fr"1050        },1051        { "field" : "ville structure",1052          "is_visible" : True,1053          "position" : "block_city",1054          "trim" : 20,1055          "locale" : "fr"1056        },1057        # { "field" : "intitulé structure", # SONUM1058        { "field" : "titre du projet", # CIS1059          "is_visible" : True,1060          "position" : "block_title",1061          "trim" : 20,1062          "locale" : "fr"1063        },1064        { "field" : "",1065          "is_visible" : True,1066          "position" : "block_image",1067          "trim" : 20,1068          "locale" : "fr"1069        },1070        { "field" : "résumé du projet",1071          "is_visible" : True,1072          "position" : "block_abstract",1073          "trim" : 50,1074          "locale" : "fr"1075        },1076        { "field" : "link_src", # spider/sourceur1077          "is_visible" : True,1078          "position" : "block_src",1079          "trim" : 50,1080          "locale" : "fr"1081        },1082        { "field" : "",1083          "is_visible" : True,1084          "position" : "block_tags",1085          "trim" : 50,1086          "locale" : "fr"1087         },1088      ],1089      "lat_long_fields" : {1090        "latitude" : "lat",1091        "longitude" : "lon"1092      },1093      "images_fields"        : {1094        "card_img_main" : { "field" : "image(s) du projet", "default" : "img_card",  "is_visible" : True  },1095        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },1096      },1097      "ui_options"        : {1098        "card_color"    : { "value" : None, "default" : "white", },1099        "text_color"    : { "value" : None, "default" : "black", },1100        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },1101        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },1102        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },1103      },1104      "links_options"  : {1105        "block_contents_links" : {1106         "is_visible"  : False,1107         "position"    : "block_bottom_1",1108         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1109         "links"       : []1110        },1111        "block_data_infos" : {1112         "is_visible"  : False,1113         "position"    : "block_bottom_2",1114         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1115         "links"       : []1116        },1117        "block_share" : {1118         "is_visible"  : False,1119         "position"    : "block_bottom_3",1120         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1121         "links"       : []1122        },1123      },1124      "has_navbar"        : True,1125      "has_footer"        : True,1126      "deactivate_btn"    : False,1127      "is_visible"        : True,1128        "is_default"      : True1129    },1130    ### PAGE - list1131    { "field"             : "cis_liste",1132      "is_global_app_homepage" : False,1133      "route_title"       : u"Rechercher",1134      "route_description" : u"Page de recherche d'Apiviz",1135      "route_activated"   : True,1136      "banner" : {1137        "activated"  : False,1138        "banner_uri" : "banner-sonum-carto"1139      },1140      "is_dataset_homepage" : False,1141      "in_main_navbar"    : False,1142      "navbar_btn_options" : {1143        "only_in_navbar_for_this_dataset" : True,1144        "position"   : "middle_right",1145        "link_type"  : "link",1146        "icon_class" : "",1147        "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1148        "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1149      },1150      "in_footer"         : False,1151      "urls"              : ["/recherche", "/recherche/liste"],1152      "template_url"      : "/static/spa.html",1153      "help"             : u"you can specify a remote template (f.e. a github url)",1154      "languages"         : ["fr"],1155        "app_version"        : version,1156      "comment"           : u"Main search route in french",1157      "is_dynamic"        : True,1158      "dataset_uri"        : "cis",1159      "dynamic_template"  : 'DynamicList',1160      "endpoint_type"     : "list",1161      "contents_fields"  : [1162        { "field" : "sd_id",1163          "is_visible" : True,1164          "position" : "block_id",1165          "trim" : 50,1166          "locale" : "fr"1167        },1168        { "field" : "adresse du projet",1169          "is_visible" : True,1170          "position" : "block_address",1171          "trim" : 20,1172          "locale" : "fr"1173        },1174        { "field" : "ville structure",1175          "is_visible" : True,1176          "position" : "block_city",1177          "trim" : 20,1178          "locale" : "fr"1179        },1180        # { "field" : "intitulé structure", #SONUM1181        { "field" : "titre du projet",#CIS1182          "is_visible" : True,1183          "position" : "block_title",1184          "trim" : 20,1185          "locale" : "fr"1186        },1187        { "field" : "",1188          "is_visible" : True,1189          "position" : "block_image",1190          "trim" : 20,1191          "locale" : "fr"1192        },1193        { "field" : "résumé du projet",1194          "is_visible" : True,1195          "position" : "block_abstract",1196          "trim" : 50,1197          "locale" : "fr"1198        },1199        { "field" : "link_src",1200          "is_visible" : True,1201          "position" : "block_src",1202          "trim" : 50,1203          "locale" : "fr"1204        },1205        { "field" : "",1206          "is_visible" : True,1207          "position" : "block_tags",1208          "trim" : 50,1209          "locale" : "fr"1210         },1211      ],1212      "images_fields"        : {1213        "card_img_main" : { "field" : "", "default" : "img_card",  "is_visible" : True  },1214        "card_img_top"  : { "field" : "", "default" : None,        "is_visible" : False },1215      },1216      "ui_options" : {1217        "card_color"    : { "value" : None, "default" : "white", },1218        "text_color"    : { "value" : None, "default" : "black", },1219        "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },1220        "link_to_next"     : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },1221        "link_to_previous" : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },1222      },1223      "links_options"  : {1224        "block_contents_links" : {1225         "is_visible"  : False,1226         "position"    : "block_bottom_1",1227         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1228         "links"       : []1229        },1230        "block_data_infos" : {1231         "is_visible"  : False,1232         "position"    : "block_bottom_2",1233         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1234         "links"       : []1235        },1236        "block_share" : {1237         "is_visible"  : False,1238         "position"    : "block_bottom_3",1239         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : False}],1240         "links"       : []1241        },1242      },1243      "has_navbar"        : True,1244      "has_footer"        : True,1245      "deactivate_btn"    : False,1246      "is_visible"        : True,1247        "is_default"        : True1248    },1249    ### PAGE - detail1250        { "field"             : "cis_detail",1251          "is_global_app_homepage" : False,1252          "route_title"        : u"Rechercher",1253          "route_description"  : u"Page de recherche d'Apiviz",1254          "route_activated"    : True,1255          "banner" : {1256            "activated"  : False,1257            "banner_uri" : "banner-sonum-carto"1258          },1259          "is_dataset_homepage" : False,1260          "in_main_navbar"    : False,1261          "navbar_btn_options" : {1262            "only_in_navbar_for_this_dataset" : True,1263            "position"   : "middle_right",1264            "link_type"  : "link",1265            "icon_class" : "",1266            "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1267            "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1268          },1269          "in_footer"         : False,1270          "urls"              : ["/project", "/cis/detail"],1271          "template_url"      : "/static/spa.html",1272          "help"              : u"you can specify a remote template (f.e. a github url)",1273          "languages"         : ["fr"],1274            "app_version"        : version,1275          "comment"           : u"Main search route in french",1276          "is_dynamic"        : True,1277          "dataset_uri"        : "cis",1278          "dynamic_template"  : 'DynamicDetail',1279          "endpoint_type"     : "detail",1280          "contents_fields"  : [1281            # { "field" : "intitulé structure", #SONUM1282            { "field" : "titre du projet",#CIS1283              "is_visible" : True,1284              "position" : "block_title",1285              "trim" : 0,1286              "locale" : "fr"1287            },1288            { "field" : "adresse du projet",1289              "is_visible" : True,1290              "position" : "block_address",1291              "trim" : 0,1292              "locale" : "fr"1293            },1294           { "field" : "code postal structure",1295              "is_visible" : True,1296              "position" : "block_cp",1297              "trim" : 0,1298              "locale" : "fr"1299            },1300            { "field" : "résumé du projet",1301              "is_visible" : True,1302              "position" : "block_abstract",1303              "trim" : 0,1304              "locale" : "fr"1305            },1306            { "field" : "link_src",1307              "is_visible" : False,1308              "position" : "block_src",1309              "trim" : 0,1310              "locale" : "fr"1311            },1312            { "field" : "services",1313              "is_visible" : True,1314              "position" : "block_tags",1315              "trim" : 0,1316              "locale" : "fr"1317            },1318            { "field" : "link_data",1319              "is_visible" : True,1320              "position" : "block_wesite",1321              "trim" : 0,1322              "locale" : "fr"1323            },1324            # optional text contents1325             # { "field"       : "services", # Not for CIS1326             #   "is_visible"  : True,1327             #   "position"    : "block_left_bottom_1",1328             #   "title_block" : [{ "locale" : "fr", "text" : "Services proposés", "is_visible" : False }],1329             # },1330             { "field"       : "tags",1331               "is_visible"  : True,1332               "position"    : "block_right_bottom_1",1333               "title_block" : [{ "locale" : "fr", "text" : "Tags", "is_visible" : True }],1334             },1335          ],1336          "images_fields"     : {1337            "card_img_main"  : { "field" : "", "default" : "img_card",  "is_visible" : True,  "position" : "block_right_top_1" },1338            "card_img_top"   : { "field" : "", "default" : None,        "is_visible" : False, "position" : "block_right_middle" },1339          },1340          "ui_options"        : {1341            "card_color"     : { "value" : None, "default" : "white", },1342            "text_color"     : { "value" : None, "default" : "black", },1343            "link_to_detail"   : { "is_visible" : True, "tooltip" : [{"locale" : "fr", "text" : "voir le document" }] },1344            "link_to_next"     : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir prochain document" }] },1345            "link_to_previous" : { "is_visible" : True,  "tooltip" : [{"locale" : "fr", "text" : "voir le document précédent" }] },1346          },1347      "links_options"  : {1348        "block_contents_links" : {1349         "is_visible"  : True,1350         "position"    : "block_left_middle_2",1351         "title_block" : [{ "locale" : "fr", "text" : "", "is_visible" : False}],1352         "links"       : [1353           { "field" : "website",1354             "is_visible" : True,1355             "link_type"  : "text",1356             "icon_class" : "",1357             "link_text"  : [{"locale" : "fr", "text" : "website" }],1358             "tooltip"    : [{"locale" : "fr", "text" : "voir le site" }]1359           },1360           { "field" : "contact",1361             "is_visible" : True,1362             "link_type"  : "text",1363             "icon_class" : "",1364             "link_text"  : [{"locale" : "fr", "text" : "contact" }],1365             "tooltip"    : [{"locale" : "fr", "text" : "contacter la structure" }]1366           },1367         ]1368        },1369        "block_share" : {1370         "is_visible"  : True,1371         "position"    : "block_left_bottom_2",1372         "title_block" : [{ "locale" : "fr", "text" : "Partagez ce lieu", "is_visible" : True}],1373         "links"       : [1374           {1375             "is_visible" : True,1376             "link_type"  : "icon",1377             "icon_class" : "fas fa-link",1378             "link_text"  : [{"locale" : "fr", "text" : "lien" }],1379             "tooltip"    : [{"locale" : "fr", "text" : "partager cette page (copier le lien)" }]1380           },1381          {1382             "is_visible" : True,1383             "link_type"  : "icon",1384             "icon_class" : "fab fa-facebook-f",1385             "link_text"  : [{"locale" : "fr", "text" : "facebook" }],1386             "tooltip"    : [{"locale" : "fr", "text" : "partager sur facebook" }]1387           },1388           {1389             "is_visible" : True,1390             "link_type"  : "icon",1391             "icon_class" : "fab fa-twitter",1392             "link_text"  : [{"locale" : "fr", "text" : "twitter" }],1393             "tooltip"    : [{"locale" : "fr", "text" : "partager sur twitter" }]1394           },1395         ]1396        },1397      },1398      "has_navbar"        : True,1399      "has_footer"        : True,1400      "deactivate_btn"    : False,1401      "is_visible"        : True,1402        "is_default"        : True1403    },1404  ### - - - - - - - - - - - - - - - - - ###1405  ### CUSTOM ROUTES-PAGES --> TO BE ADDED VIA BACK OFFICE BY ADMIN USER1406  ### - - - - - - - - - - - - - - - - - ###1407  ### PAGE : QUI SOMMES-NOUS1408  { "field"             : "app_who_fr",1409    "is_global_app_homepage" : False,1410    "route_title"        : u"Home",1411    "route_description"  : u"Qui sommes-nous",1412    "route_activated"    : True,1413    "banner" : {1414      "activated"  : False,1415      "banner_uri" : "default"1416    },1417    "is_dataset_homepage" : False,1418    "in_main_navbar"    : True,1419    "navbar_btn_options" : {1420      "position"   : "middle_right",1421      "link_type"  : "button",1422      "icon_class" : "",1423      "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1424      "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1425    },1426    "in_footer"         : False,1427    "link_in_logo"      : False,1428    "urls"              : ["/qui-sommes-nous"],1429    # "template_url"      : "https://github.com/co-demos/carto-sonum/blob/master/pages-html/qui-sommes-nous.html?raw=true",1430    "template_url"      : "https://github.com/CBalsier/test-contact/blob/master/pages-html/le-collectif.html?raw=true",1431    "help"              : u"you can specify a remote template (f.e. a github url)",1432    "languages"         : ["fr"],1433      "app_version"        : version,1434    "comment"           : u"A custom page for your ApiViz app",1435    "is_dynamic"        : True,1436    "dynamic_template"  : 'DynamicStatic',1437    "has_navbar"        : True,1438    "has_footer"        : True,1439      "is_default"        : True1440  },1441   ### PAGE : JOIN US/NOUS REJOINDRE1442   { "field"             : "app_join_us",1443     "is_global_app_homepage" : False,1444     "route_title"        : u"Home",1445     "route_description"  : u"Nous rejoindre",1446     "route_activated"    : True,1447     "banner" : {1448       "activated"  : False,1449       "banner_uri" : "default"1450     },1451     "is_dataset_homepage" : False,1452     "in_main_navbar"    : True,1453     "navbar_btn_options" : {1454       "position"   : "middle_right",1455       "link_type"  : "button",1456       "icon_class" : "",1457       "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1458       "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1459     },1460     "in_footer"         : False,1461     "link_in_logo"      : False,1462     "urls"              : ["/nous-rejoindre"],1463     # "template_url"      : "https://github.com/co-demos/carto-sonum/blob/master/pages-html/qui-sommes-nous.html?raw=true",1464     "template_url"      : "https://github.com/CBalsier/test-contact/blob/master/pages-html/nous-rejoindre.html?raw=true",1465     "help"              : u"you can specify a remote template (f.e. a github url)",1466     "languages"         : ["fr"],1467       "app_version"        : version,1468     "comment"           : u"A custom page for your ApiViz app",1469     "is_dynamic"        : True,1470     "dynamic_template"  : 'DynamicStatic',1471     "has_navbar"        : True,1472     "has_footer"        : True,1473       "is_default"        : True1474   },1475  ### PAGES : TOOLS1476  { "field"              : "app_outils",1477    "is_global_app_homepage" : False,1478    "route_title"        : u"Outils",1479    "route_description"  : u"Nos outils",1480    "route_activated"    : True,1481    "banner" : {1482      "activated"  : False,1483      "banner_uri" : "default"1484    },1485    "is_dataset_homepage" : False,1486    "in_main_navbar"    : False,1487    "navbar_btn_options" : {1488      "position"   : "middle_right",1489      "link_type"  : "button",1490      "icon_class" : "",1491      "link_text"  : [{"locale" : "fr", "text" : "Recherher un lieu" }],1492      "tooltip"    : [{"locale" : "fr", "text" : "Rechercher" }],1493    },1494    "in_footer"         : True,1495    "urls"              : ["/nos-outils"],1496    "template_url"      : "/static/les-outils.html",1497    "help"              : u"you can specify a remote template (f.e. a github url)",1498    "languages"         : ["fr"],1499      "app_version"        : version,1500    "comment"           : u"Main tools route in french",1501    "is_dynamic"        : False,1502    "dynamic_template"  : None,1503    "has_navbar"        : True,1504    "has_footer"        : True,1505      "is_default"        : True1506  },1507    ### PAGE TOOLS - FR1508    { "field"             : "app_tools",1509      "is_global_app_homepage" : True,1510      "route_title"       : u"Outils",1511      "route_description" : u"apiviz default tools page",1512      "route_activated"   : True,1513      "banner" : {1514        "activated"  : False,1515        "banner_uri" : ""1516      },1517      "in_main_navbar"    : False,1518      "navbar_btn_options" : {1519        "position"   : "middle_right",1520        "link_type"  : "link",1521        "icon_class" : "",1522        "link_text"  : [{"locale" : "fr", "text" : "" }],1523        "tooltip"    : [{"locale" : "fr", "text" : "" }],1524      },1525      "in_footer"         : True,1526      "link_in_logo"      : False,1527      "urls"              : ["/apiviz/outils"],1528      "template_url"      : "https://raw.githubusercontent.com/co-demos/structure/master/pages-html/tools-fr.html",1529      "help"              : u"you can specify a remote template (f.e. a github url)",1530      "languages"         : ["fr"],1531        "app_version"       : version,1532      "comment"           : u"Main apiviz tools route in french",1533      "is_dynamic"        : True,1534      "dynamic_template"  : "DynamicStatic",1535      "has_navbar"        : True,1536      "has_footer"        : True,1537        "is_default"        : True1538    },1539  ### ......nfvo.py
Source:nfvo.py  
1# Copyright 2016 Brocade Communications Systems Inc2# All Rights Reserved.3#4#    Licensed under the Apache License, Version 2.0 (the "License"); you may5#    not use this file except in compliance with the License. You may obtain6#    a copy of the License at7#8#         http://www.apache.org/licenses/LICENSE-2.09#10#    Unless required by applicable law or agreed to in writing, software11#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13#    License for the specific language governing permissions and limitations14#    under the License.15import abc16import six17from tacker._i18n import _18from tacker.api import extensions19from tacker.api.v1 import attributes as attr20from tacker.api.v1 import resource_helper21from tacker.common import exceptions22from tacker.plugins.common import constants23from tacker.services import service_base24class VimUnauthorizedException(exceptions.TackerException):25    message = _("%(message)s")26class VimConnectionException(exceptions.TackerException):27    message = _("%(message)s")28class VimInUseException(exceptions.TackerException):29    message = _("VIM %(vim_id)s is still in use by VNF")30class VimDefaultNotDefined(exceptions.TackerException):31    message = _("Default VIM is not defined.")32class VimDefaultDuplicateException(exceptions.TackerException):33    message = _("Default VIM already exists %(vim_id)s.")34class VimNotFoundException(exceptions.TackerException):35    message = _("Specified VIM id %(vim_id)s is invalid. Please verify and "36                "pass a valid VIM id")37class VimRegionNotFoundException(exceptions.TackerException):38    message = _("Unknown VIM region name %(region_name)s")39class VimKeyNotFoundException(exceptions.TackerException):40    message = _("Unable to find key file for VIM %(vim_id)s")41class VimEncryptKeyError(exceptions.TackerException):42    message = _("Barbican must be enabled for VIM %(vim_id)s")43class VimUnsupportedResourceTypeException(exceptions.TackerException):44    message = _("Resource type %(type)s is unsupported by VIM")45class VimGetResourceException(exceptions.TackerException):46    message = _("Error while trying to issue %(cmd)s to find resource type "47                "%(type)s by resource name %(name)s")48class VimGetResourceNameNotUnique(exceptions.TackerException):49    message = _("Getting resource id from VIM with resource name %(name)s "50                "by %(cmd)s returns more than one")51class VimGetResourceNotFoundException(exceptions.TackerException):52    message = _("Getting resource id from VIM with resource name %(name)s "53                "by %(cmd)s returns nothing")54class VimFromVnfNotFoundException(exceptions.NotFound):55    message = _('VIM from VNF %(vnf_id)s could not be found')56class ToscaParserFailed(exceptions.InvalidInput):57    message = _("tosca-parser failed: - %(error_msg_details)s")58class VnffgdInvalidTemplate(exceptions.InvalidInput):59    message = _("Invalid VNFFG template input: %(template)s")60class VnffgdDuplicateForwarderException(exceptions.InvalidInput):61    message = _("Invalid Forwarding Path contains duplicate forwarder not in "62                "order: %(forwarder)s")63class VnffgdDuplicateCPException(exceptions.InvalidInput):64    message = _("Invalid Forwarding Path contains duplicate connection point "65                ": %(cp)s")66class VnffgdVnfdNotFoundException(exceptions.NotFound):67    message = _("Specified VNFD %(vnfd_name)s in VNFFGD does not exist. "68                "Please create VNFDs before creating VNFFG")69class VnffgdCpNotFoundException(exceptions.NotFound):70    message = _("Specified CP %(cp_id)s could not be found in VNFD "71                "%(vnfd_name)s. Please check VNFD for correct Connection "72                "Point.")73class VnffgdCpNoForwardingException(exceptions.TackerException):74    message = _("Specified CP %(cp_id)s in VNFD %(vnfd_name)s "75                "does not have forwarding capability, which is required to be "76                "included in forwarding path")77class VnffgdWrongEndpointNumber(exceptions.TackerException):78    message = _("Specified number_of_endpoints %(number)s is not equal to "79                "the number of connection_point %(cps)s")80class VnffgdInUse(exceptions.InUse):81    message = _('VNFFGD %(vnffgd_id)s is still in use')82class VnffgdNotFoundException(exceptions.NotFound):83    message = _('VNFFG Template %(vnffgd_id)s could not be found')84class VnffgCreateFailed(exceptions.TackerException):85    message = _('Creating VNFFG based on %(vnffgd_id)s failed')86class VnffgInvalidMappingException(exceptions.TackerException):87    message = _("Matching VNF Instance for VNFD %(vnfd_name)s could not be "88                "found. Please create an instance of this VNFD before "89                "creating/updating VNFFG.")90class VnffgParamValueFormatError(exceptions.TackerException):91    message = _("Param values %(param_value)s is not in dict format.")92class VnffgTemplateParamParsingException(exceptions.TackerException):93    message = _("Failed to parse VNFFG Template due to "94                "missing input param %(get_input)s.")95class VnffgPropertyNotFoundException(exceptions.NotFound):96    message = _('VNFFG Property %(vnffg_property)s could not be found')97class VnffgCpNotFoundException(exceptions.NotFound):98    message = _("Specified CP %(cp_id)s could not be found in VNF "99                "%(vnf_id)s.")100class VnffgNotFoundException(exceptions.NotFound):101    message = _('VNFFG %(vnffg_id)s could not be found')102class VnffgInUse(exceptions.InUse):103    message = _('VNFFG %(vnffg_id)s is still in use')104class VnffgVnfNotFoundException(exceptions.NotFound):105    message = _("Specified VNF instance %(vnf_name)s in VNF Mapping could not "106                "be found")107class VnffgDeleteFailed(exceptions.TackerException):108    message = _('Deleting VNFFG %(vnffg_id)s failed')109class VnffgInUseNS(exceptions.TackerException):110    message = _('VNFFG %(vnffg_id)s belongs to active network service '111                '%(ns_id)s')112class NfpAttributeNotFoundException(exceptions.NotFound):113    message = _('NFP attribute %(attribute)s could not be found')114class NfpNotFoundException(exceptions.NotFound):115    message = _('NFP %(nfp_id)s could not be found')116class NfpInUse(exceptions.InUse):117    message = _('NFP %(nfp_id)s is still in use')118class NfpPolicyCriteriaError(exceptions.PolicyCheckError):119    message = _('%(error)s in policy')120class NfpPolicyCriteriaIndexError(exceptions.TackerException):121    message = _('Criteria list can not be empty')122class NfpDuplicatePolicyCriteria(exceptions.TackerException):123    message = _('The %(first_dict)s and %(sec_dict)s are overlapped')124class NfpDuplicatePathID(exceptions.TackerException):125    message = _('The path_id %(path_id)s is overlapped with '126                'NFP %(nfp_name)s in %(vnffg_name)s')127class NfpPolicyTypeError(exceptions.PolicyCheckError):128    message = _('Unsupported Policy Type: %(type)s')129class NfpForwarderNotFoundException(exceptions.NotFound):130    message = _('VNFD Forwarder %(vnfd)s not found in VNF Mapping %(mapping)s')131class NfpRequirementsException(exceptions.TackerException):132    message = _('VNFD Forwarder %(vnfd)s specified more than twice in '133                'requirements path')134class SfcInUse(exceptions.InUse):135    message = _('SFC %(sfc_id)s is still in use')136class SfcNotFoundException(exceptions.NotFound):137    message = _('Service Function Chain %(sfc_id)s could not be found')138class ClassifierInUse(exceptions.InUse):139    message = _('Classifier %(classifier_id)s is still in use')140class ClassifierNotFoundException(exceptions.NotFound):141    message = _('Classifier %(classifier_id)s could not be found')142class VnfMappingNotFoundException(exceptions.NotFound):143    message = _('VNF mapping not found/defined')144class VnfMappingNotValidException(exceptions.TackerException):145    message = _('The %(vnfd)s is not found in constituent VNFDs')146class NSDInUse(exceptions.InUse):147    message = _('NSD %(nsd_id)s is still in use')148class NSInUse(exceptions.InUse):149    message = _('NS %(ns_id)s is still in use')150class NoTasksException(exceptions.TackerException):151    message = _('No tasks to run for %(action)s on %(resource)s')152class UpdateChainException(exceptions.TackerException):153    message = _("%(message)s")154class CreateChainException(exceptions.TackerException):155    message = _("%(message)s")156class UpdateClassifierException(exceptions.TackerException):157    message = _("%(message)s")158class UpdateVnffgException(exceptions.TackerException):159    message = _("%(message)s")160class FlowClassiferCreationFailed(exceptions.TackerException):161    message = _("%(message)s")162NAME_MAX_LEN = 255163RESOURCE_ATTRIBUTE_MAP = {164    'vims': {165        'id': {166            'allow_post': False,167            'allow_put': False,168            'validate': {'type:uuid': None},169            'is_visible': True,170            'primary_key': True,171        },172        'tenant_id': {173            'allow_post': True,174            'allow_put': False,175            'validate': {'type:string': None},176            'required_by_policy': True,177            'is_visible': True178        },179        'type': {180            'allow_post': True,181            'allow_put': False,182            'validate': {'type:not_empty_string': None},183            'is_visible': True184        },185        'auth_url': {186            'allow_post': True,187            'allow_put': False,188            'validate': {'type:string': None},189            'is_visible': True190        },191        'auth_cred': {192            'allow_post': True,193            'allow_put': True,194            'validate': {'type:dict_not_empty': None},195            'is_visible': True,196        },197        'vim_project': {198            'allow_post': True,199            'allow_put': True,200            'validate': {'type:dict_not_empty': None},201            'is_visible': True,202        },203        'name': {204            'allow_post': True,205            'allow_put': True,206            'validate': {'type:string': NAME_MAX_LEN},207            'is_visible': True,208        },209        'description': {210            'allow_post': True,211            'allow_put': True,212            'validate': {'type:string': None},213            'is_visible': True,214            'default': '',215        },216        'status': {217            'allow_post': False,218            'allow_put': False,219            'validate': {'type:string': None},220            'is_visible': True,221        },222        'placement_attr': {223            'allow_post': False,224            'allow_put': False,225            'is_visible': True,226            'default': None,227        },228        'shared': {229            'allow_post': False,230            'allow_put': False,231            'is_visible': False,232            'convert_to': attr.convert_to_boolean,233            'required_by_policy': True234        },235        'is_default': {236            'allow_post': True,237            'allow_put': True,238            'is_visible': True,239            'validate': {'type:boolean': None},240            'default': False241        },242        'created_at': {243            'allow_post': False,244            'allow_put': False,245            'is_visible': True,246        },247        'updated_at': {248            'allow_post': False,249            'allow_put': False,250            'is_visible': True,251        },252    },253    'vnffgds': {254        'id': {255            'allow_post': False,256            'allow_put': False,257            'validate': {'type:uuid': None},258            'is_visible': True,259            'primary_key': True,260        },261        'tenant_id': {262            'allow_post': True,263            'allow_put': False,264            'validate': {'type:string': None},265            'required_by_policy': True,266            'is_visible': True,267        },268        'name': {269            'allow_post': True,270            'allow_put': True,271            'validate': {'type:string': NAME_MAX_LEN},272            'is_visible': True,273        },274        'description': {275            'allow_post': True,276            'allow_put': True,277            'validate': {'type:string': None},278            'is_visible': True,279            'default': '',280        },281        'template': {282            'allow_post': True,283            'allow_put': False,284            'convert_to': attr.convert_none_to_empty_dict,285            'validate': {'type:dict_or_nodata': None},286            'is_visible': True,287            'default': None,288        },289        'template_source': {290            'allow_post': False,291            'allow_put': False,292            'is_visible': True,293            'default': 'onboarded'294        }295    },296    'vnffgs': {297        'id': {298            'allow_post': False,299            'allow_put': False,300            'validate': {'type:uuid': None},301            'is_visible': True,302            'primary_key': True303        },304        'tenant_id': {305            'allow_post': True,306            'allow_put': False,307            'validate': {'type:string': None},308            'required_by_policy': True,309            'is_visible': True310        },311        'vnffgd_id': {312            'allow_post': True,313            'allow_put': False,314            'validate': {'type:uuid': None},315            'is_visible': True,316            'default': None317        },318        'name': {319            'allow_post': True,320            'allow_put': True,321            'validate': {'type:string': NAME_MAX_LEN},322            'is_visible': True,323        },324        'description': {325            'allow_post': True,326            'allow_put': True,327            'validate': {'type:string': None},328            'is_visible': True,329            'default': '',330        },331        'vnf_mapping': {332            'allow_post': True,333            'allow_put': True,334            'convert_to': attr.convert_none_to_empty_dict,335            'validate': {'type:dict_or_nodata': None},336            'is_visible': True,337            'default': None,338        },339        'attributes': {340            'allow_post': True,341            'allow_put': True,342            'convert_to': attr.convert_none_to_empty_dict,343            'validate': {'type:dict_or_nodata': None},344            'is_visible': True,345            'default': None,346        },347        'symmetrical': {348            'allow_post': True,349            'allow_put': True,350            'is_visible': True,351            'validate': {'type:boolean': None},352            'default': False,353        },354        'forwarding_paths': {355            'allow_post': False,356            'allow_put': False,357            'is_visible': True,358        },359        'status': {360            'allow_post': False,361            'allow_put': False,362            'is_visible': True,363        },364        'vnffgd_template': {365            'allow_post': True,366            'allow_put': True,367            'validate': {'type:dict_or_nodata': None},368            'is_visible': True,369            'default': None,370        },371        'ns_id': {372            'allow_post': True,373            'allow_put': False,374            'is_visible': True,375            'default': None,376        },377    },378    'nfps': {379        'id': {380            'allow_post': False,381            'allow_put': False,382            'validate': {'type:uuid': None},383            'is_visible': True,384            'primary_key': True385        },386        'tenant_id': {387            'allow_post': False,388            'allow_put': False,389            'validate': {'type:string': None},390            'required_by_policy': True,391            'is_visible': True392        },393        'vnffg_id': {394            'allow_post': False,395            'allow_put': False,396            'validate': {'type:uuid': None},397            'is_visible': True,398        },399        'name': {400            'allow_post': False,401            'allow_put': False,402            'validate': {'type:string': None},403            'is_visible': True,404        },405        'classifier_id': {406            'allow_post': False,407            'allow_put': False,408            'validate': {'type:uuid': None},409            'is_visible': True,410        },411        'chain_id': {412            'allow_post': False,413            'allow_put': False,414            'validate': {'type:uuid': None},415            'is_visible': True,416        },417        'path_id': {418            'allow_post': False,419            'allow_put': False,420            'validate': {'type:string': None},421            'is_visible': True,422        },423        'symmetrical': {424            'allow_post': False,425            'allow_put': False,426            'is_visible': True,427            'validate': {'type:boolean': None},428            'default': False,429        },430        'status': {431            'allow_post': False,432            'allow_put': False,433            'is_visible': True,434        },435    },436    'sfcs': {437        'id': {438            'allow_post': False,439            'allow_put': False,440            'validate': {'type:uuid': None},441            'is_visible': True,442            'primary_key': True443        },444        'tenant_id': {445            'allow_post': False,446            'allow_put': False,447            'validate': {'type:string': None},448            'required_by_policy': True,449            'is_visible': True450        },451        'nfp_id': {452            'allow_post': False,453            'allow_put': False,454            'validate': {'type:uuid': None},455            'is_visible': True,456        },457        'instance_id': {458            'allow_post': False,459            'allow_put': False,460            'validate': {'type:uuid': None},461            'is_visible': True,462        },463        'chain': {464            'allow_post': False,465            'allow_put': False,466            'is_visible': True,467        },468        'path_id': {469            'allow_post': False,470            'allow_put': False,471            'is_visible': True,472        },473        'symmetrical': {474            'allow_post': False,475            'allow_put': False,476            'is_visible': True,477            'validate': {'type:boolean': None},478            'default': False,479        },480        'status': {481            'allow_post': False,482            'allow_put': False,483            'is_visible': True,484        },485    },486    'classifiers': {487        'id': {488            'allow_post': False,489            'allow_put': False,490            'validate': {'type:uuid': None},491            'is_visible': True,492            'primary_key': True493        },494        'tenant_id': {495            'allow_post': False,496            'allow_put': False,497            'validate': {'type:string': None},498            'required_by_policy': True,499            'is_visible': True500        },501        'nfp_id': {502            'allow_post': False,503            'allow_put': False,504            'validate': {'type:uuid': None},505            'is_visible': True,506        },507        'instance_id': {508            'allow_post': False,509            'allow_put': False,510            'validate': {'type:uuid': None},511            'is_visible': True,512        },513        'match': {514            'allow_post': False,515            'allow_put': False,516            'is_visible': True,517        },518        'chain_id': {519            'allow_post': False,520            'allow_put': False,521            'is_visible': True,522        },523        'status': {524            'allow_post': False,525            'allow_put': False,526            'is_visible': True,527        },528        'name': {529            'allow_post': True,530            'allow_put': True,531            'validate': {'type:string': NAME_MAX_LEN},532            'is_visible': True,533        },534    },535    'nsds': {536        'id': {537            'allow_post': False,538            'allow_put': False,539            'validate': {'type:uuid': None},540            'is_visible': True,541            'primary_key': True,542        },543        'tenant_id': {544            'allow_post': True,545            'allow_put': False,546            'validate': {'type:string': None},547            'required_by_policy': True,548            'is_visible': True,549        },550        'name': {551            'allow_post': True,552            'allow_put': True,553            'validate': {'type:string': NAME_MAX_LEN},554            'is_visible': True,555        },556        'description': {557            'allow_post': True,558            'allow_put': True,559            'validate': {'type:string': None},560            'is_visible': True,561            'default': '',562        },563        'created_at': {564            'allow_post': False,565            'allow_put': False,566            'is_visible': True,567        },568        'updated_at': {569            'allow_post': False,570            'allow_put': False,571            'is_visible': True,572        },573        'attributes': {574            'allow_post': True,575            'allow_put': False,576            'convert_to': attr.convert_none_to_empty_dict,577            'validate': {'type:dict_or_nodata': None},578            'is_visible': True,579            'default': None,580        },581        'template_source': {582            'allow_post': False,583            'allow_put': False,584            'is_visible': True,585            'default': 'onboarded'586        },587    },588    'nss': {589        'id': {590            'allow_post': False,591            'allow_put': False,592            'validate': {'type:uuid': None},593            'is_visible': True,594            'primary_key': True,595        },596        'tenant_id': {597            'allow_post': True,598            'allow_put': False,599            'validate': {'type:string': None},600            'required_by_policy': True,601            'is_visible': True,602        },603        'name': {604            'allow_post': True,605            'allow_put': True,606            'validate': {'type:string': NAME_MAX_LEN},607            'is_visible': True,608        },609        'description': {610            'allow_post': True,611            'allow_put': True,612            'validate': {'type:string': NAME_MAX_LEN},613            'is_visible': True,614            'default': '',615        },616        'created_at': {617            'allow_post': False,618            'allow_put': False,619            'is_visible': True,620        },621        'updated_at': {622            'allow_post': False,623            'allow_put': False,624            'is_visible': True,625        },626        'vnf_ids': {627            'allow_post': True,628            'allow_put': False,629            'validate': {'type:string': None},630            'is_visible': True,631            'default': '',632        },633        'vnffg_ids': {634            'allow_post': True,635            'allow_put': False,636            'validate': {'type:string': None},637            'is_visible': True,638            'default': '',639        },640        'nsd_id': {641            'allow_post': True,642            'allow_put': False,643            'validate': {'type:uuid': None},644            'is_visible': True,645            'default': None,646        },647        'placement_attr': {648            'allow_post': True,649            'allow_put': False,650            'validate': {'type:dict_or_none': None},651            'is_visible': True,652            'default': {},653        },654        'vim_id': {655            'allow_post': True,656            'allow_put': False,657            'validate': {'type:string': None},658            'is_visible': True,659            'default': '',660        },661        'status': {662            'allow_post': False,663            'allow_put': False,664            'is_visible': True,665        },666        'error_reason': {667            'allow_post': False,668            'allow_put': False,669            'is_visible': True,670        },671        'attributes': {672            'allow_post': True,673            'allow_put': False,674            'convert_to': attr.convert_none_to_empty_dict,675            'validate': {'type:dict_or_nodata': None},676            'is_visible': True,677            'default': None,678        },679        'mgmt_ip_addresses': {680            'allow_post': False,681            'allow_put': False,682            'convert_to': attr.convert_none_to_empty_dict,683            'validate': {'type:dict_or_nodata': None},684            'is_visible': True,685        },686        'nsd_template': {687            'allow_post': True,688            'allow_put': False,689            'validate': {'type:dict_or_nodata': None},690            'is_visible': True,691            'default': None,692        },693    },694}695class Nfvo(extensions.ExtensionDescriptor):696    @classmethod697    def get_name(cls):698        return 'NFV Orchestrator'699    @classmethod700    def get_alias(cls):701        return 'NFVO'702    @classmethod703    def get_description(cls):704        return "Extension for NFV Orchestrator"705    @classmethod706    def get_namespace(cls):707        return 'https://wiki.openstack.org/Tacker'708    @classmethod709    def get_updated(cls):710        return "2015-12-21T10:00:00-00:00"711    @classmethod712    def get_resources(cls):713        special_mappings = {}714        plural_mappings = resource_helper.build_plural_mappings(715            special_mappings, RESOURCE_ATTRIBUTE_MAP)716        attr.PLURALS.update(plural_mappings)717        return resource_helper.build_resource_info(718            plural_mappings, RESOURCE_ATTRIBUTE_MAP, constants.NFVO,719            translate_name=True)720    @classmethod721    def get_plugin_interface(cls):722        return NFVOPluginBase723    def update_attributes_map(self, attributes):724        super(Nfvo, self).update_attributes_map(725            attributes, extension_attrs_map=RESOURCE_ATTRIBUTE_MAP)726    def get_extended_resources(self, version):727        version_map = {'1.0': RESOURCE_ATTRIBUTE_MAP}728        return version_map.get(version, {})729@six.add_metaclass(abc.ABCMeta)730class NFVOPluginBase(service_base.NFVPluginBase):731    def get_plugin_name(self):732        return constants.NFVO733    def get_plugin_type(self):734        return constants.NFVO735    def get_plugin_description(self):736        return 'Tacker NFV Orchestrator plugin'737    @abc.abstractmethod738    def create_vim(self, context, vim):739        pass740    @abc.abstractmethod741    def update_vim(self, context, vim_id, vim):742        pass743    @abc.abstractmethod744    def delete_vim(self, context, vim_id):745        pass746    @abc.abstractmethod747    def get_vim(self, context, vim_id, fields=None, mask_password=True):748        pass749    @abc.abstractmethod750    def get_vims(self, context, filters=None, fields=None):751        pass752    def get_vim_by_name(self, context, vim_name, fields=None,753                        mask_password=True):754        raise NotImplementedError()755    def get_default_vim(self, context):...loadbalancer.py
Source:loadbalancer.py  
1# Copyright 2012 OpenStack Foundation.2# All Rights Reserved.3#4#    Licensed under the Apache License, Version 2.0 (the "License"); you may5#    not use this file except in compliance with the License. You may obtain6#    a copy of the License at7#8#         http://www.apache.org/licenses/LICENSE-2.09#10#    Unless required by applicable law or agreed to in writing, software11#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13#    License for the specific language governing permissions and limitations14#    under the License.15import abc16from oslo.config import cfg17import six18from neutron.api import extensions19from neutron.api.v2 import attributes as attr20from neutron.api.v2 import base21from neutron.api.v2 import resource_helper22from neutron.common import exceptions as qexception23from neutron import manager24from neutron.plugins.common import constants25from neutron.services import service_base26# Loadbalancer Exceptions27class DelayOrTimeoutInvalid(qexception.BadRequest):28    message = _("Delay must be greater than or equal to timeout")29class NoEligibleBackend(qexception.NotFound):30    message = _("No eligible backend for pool %(pool_id)s")31class VipNotFound(qexception.NotFound):32    message = _("Vip %(vip_id)s could not be found")33class VipExists(qexception.NeutronException):34    message = _("Another Vip already exists for pool %(pool_id)s")35class PoolNotFound(qexception.NotFound):36    message = _("Pool %(pool_id)s could not be found")37class MemberNotFound(qexception.NotFound):38    message = _("Member %(member_id)s could not be found")39class HealthMonitorNotFound(qexception.NotFound):40    message = _("Health_monitor %(monitor_id)s could not be found")41class PoolMonitorAssociationNotFound(qexception.NotFound):42    message = _("Monitor %(monitor_id)s is not associated "43                "with Pool %(pool_id)s")44class PoolMonitorAssociationExists(qexception.Conflict):45    message = _('health_monitor %(monitor_id)s is already associated '46                'with pool %(pool_id)s')47class StateInvalid(qexception.NeutronException):48    message = _("Invalid state %(state)s of Loadbalancer resource %(id)s")49class PoolInUse(qexception.InUse):50    message = _("Pool %(pool_id)s is still in use")51class HealthMonitorInUse(qexception.InUse):52    message = _("Health monitor %(monitor_id)s still has associations with "53                "pools")54class PoolStatsNotFound(qexception.NotFound):55    message = _("Statistics of Pool %(pool_id)s could not be found")56class ProtocolMismatch(qexception.BadRequest):57    message = _("Protocol %(vip_proto)s does not match "58                "pool protocol %(pool_proto)s")59class MemberExists(qexception.NeutronException):60    message = _("Member with address %(address)s and port %(port)s "61                "already present in pool %(pool)s")62RESOURCE_ATTRIBUTE_MAP = {63    'vips': {64        'id': {'allow_post': False, 'allow_put': False,65               'validate': {'type:uuid': None},66               'is_visible': True,67               'primary_key': True},68        'tenant_id': {'allow_post': True, 'allow_put': False,69                      'validate': {'type:string': None},70                      'required_by_policy': True,71                      'is_visible': True},72        'name': {'allow_post': True, 'allow_put': True,73                 'validate': {'type:string': None},74                 'default': '',75                 'is_visible': True},76        'description': {'allow_post': True, 'allow_put': True,77                        'validate': {'type:string': None},78                        'is_visible': True, 'default': ''},79        'subnet_id': {'allow_post': True, 'allow_put': False,80                      'validate': {'type:uuid': None},81                      'is_visible': True},82        'address': {'allow_post': True, 'allow_put': False,83                    'default': attr.ATTR_NOT_SPECIFIED,84                    'validate': {'type:ip_address_or_none': None},85                    'is_visible': True},86        'port_id': {'allow_post': False, 'allow_put': False,87                    'validate': {'type:uuid': None},88                    'is_visible': True},89        'protocol_port': {'allow_post': True, 'allow_put': False,90                          'validate': {'type:range': [0, 65535]},91                          'convert_to': attr.convert_to_int,92                          'is_visible': True},93        'protocol': {'allow_post': True, 'allow_put': False,94                     'validate': {'type:values': ['TCP', 'HTTP', 'HTTPS']},95                     'is_visible': True},96        'pool_id': {'allow_post': True, 'allow_put': True,97                    'validate': {'type:uuid': None},98                    'is_visible': True},99        'session_persistence': {'allow_post': True, 'allow_put': True,100                                'convert_to': attr.convert_none_to_empty_dict,101                                'default': {},102                                'validate': {103                                    'type:dict_or_empty': {104                                        'type': {'type:values': ['APP_COOKIE',105                                                                 'HTTP_COOKIE',106                                                                 'SOURCE_IP'],107                                                 'required': True},108                                        'cookie_name': {'type:string': None,109                                                        'required': False}}},110                                'is_visible': True},111        'connection_limit': {'allow_post': True, 'allow_put': True,112                             'default': -1,113                             'convert_to': attr.convert_to_int,114                             'is_visible': True},115        'admin_state_up': {'allow_post': True, 'allow_put': True,116                           'default': True,117                           'convert_to': attr.convert_to_boolean,118                           'is_visible': True},119        'status': {'allow_post': False, 'allow_put': False,120                   'is_visible': True},121        'status_description': {'allow_post': False, 'allow_put': False,122                               'is_visible': True}123    },124    'pools': {125        'id': {'allow_post': False, 'allow_put': False,126               'validate': {'type:uuid': None},127               'is_visible': True,128               'primary_key': True},129        'tenant_id': {'allow_post': True, 'allow_put': False,130                      'validate': {'type:string': None},131                      'required_by_policy': True,132                      'is_visible': True},133        'vip_id': {'allow_post': False, 'allow_put': False,134                   'is_visible': True},135        'name': {'allow_post': True, 'allow_put': True,136                 'validate': {'type:string': None},137                 'default': '',138                 'is_visible': True},139        'description': {'allow_post': True, 'allow_put': True,140                        'validate': {'type:string': None},141                        'is_visible': True, 'default': ''},142        'subnet_id': {'allow_post': True, 'allow_put': False,143                      'validate': {'type:uuid': None},144                      'is_visible': True},145        'protocol': {'allow_post': True, 'allow_put': False,146                     'validate': {'type:values': ['TCP', 'HTTP', 'HTTPS']},147                     'is_visible': True},148        'provider': {'allow_post': True, 'allow_put': False,149                     'validate': {'type:string': None},150                     'is_visible': True, 'default': attr.ATTR_NOT_SPECIFIED},151        'lb_method': {'allow_post': True, 'allow_put': True,152                      'validate': {'type:string': None},153                      'is_visible': True},154        'members': {'allow_post': False, 'allow_put': False,155                    'is_visible': True},156        'health_monitors': {'allow_post': True, 'allow_put': True,157                            'default': None,158                            'validate': {'type:uuid_list': None},159                            'convert_to': attr.convert_to_list,160                            'is_visible': True},161        'health_monitors_status': {'allow_post': False, 'allow_put': False,162                                   'is_visible': True},163        'admin_state_up': {'allow_post': True, 'allow_put': True,164                           'default': True,165                           'convert_to': attr.convert_to_boolean,166                           'is_visible': True},167        'status': {'allow_post': False, 'allow_put': False,168                   'is_visible': True},169        'status_description': {'allow_post': False, 'allow_put': False,170                               'is_visible': True}171    },172    'members': {173        'id': {'allow_post': False, 'allow_put': False,174               'validate': {'type:uuid': None},175               'is_visible': True,176               'primary_key': True},177        'tenant_id': {'allow_post': True, 'allow_put': False,178                      'validate': {'type:string': None},179                      'required_by_policy': True,180                      'is_visible': True},181        'pool_id': {'allow_post': True, 'allow_put': True,182                    'validate': {'type:uuid': None},183                    'is_visible': True},184        'address': {'allow_post': True, 'allow_put': False,185                    'validate': {'type:ip_address': None},186                    'is_visible': True},187        'protocol_port': {'allow_post': True, 'allow_put': False,188                          'validate': {'type:range': [0, 65535]},189                          'convert_to': attr.convert_to_int,190                          'is_visible': True},191        'weight': {'allow_post': True, 'allow_put': True,192                   'default': 1,193                   'validate': {'type:range': [0, 256]},194                   'convert_to': attr.convert_to_int,195                   'is_visible': True},196        'admin_state_up': {'allow_post': True, 'allow_put': True,197                           'default': True,198                           'convert_to': attr.convert_to_boolean,199                           'is_visible': True},200        'status': {'allow_post': False, 'allow_put': False,201                   'is_visible': True},202        'status_description': {'allow_post': False, 'allow_put': False,203                               'is_visible': True}204    },205    'health_monitors': {206        'id': {'allow_post': False, 'allow_put': False,207               'validate': {'type:uuid': None},208               'is_visible': True,209               'primary_key': True},210        'tenant_id': {'allow_post': True, 'allow_put': False,211                      'validate': {'type:string': None},212                      'required_by_policy': True,213                      'is_visible': True},214        'type': {'allow_post': True, 'allow_put': False,215                 'validate': {'type:values': ['PING', 'TCP', 'HTTP', 'HTTPS']},216                 'is_visible': True},217        'delay': {'allow_post': True, 'allow_put': True,218                  'validate': {'type:non_negative': None},219                  'convert_to': attr.convert_to_int,220                  'is_visible': True},221        'timeout': {'allow_post': True, 'allow_put': True,222                    'validate': {'type:non_negative': None},223                    'convert_to': attr.convert_to_int,224                    'is_visible': True},225        'max_retries': {'allow_post': True, 'allow_put': True,226                        'validate': {'type:range': [1, 10]},227                        'convert_to': attr.convert_to_int,228                        'is_visible': True},229        'http_method': {'allow_post': True, 'allow_put': True,230                        'validate': {'type:string': None},231                        'default': 'GET',232                        'is_visible': True},233        'url_path': {'allow_post': True, 'allow_put': True,234                     'validate': {'type:string': None},235                     'default': '/',236                     'is_visible': True},237        'expected_codes': {'allow_post': True, 'allow_put': True,238                           'validate': {239                               'type:regex':240                               '^(\d{3}(\s*,\s*\d{3})*)$|^(\d{3}-\d{3})$'},241                           'default': '200',242                           'is_visible': True},243        'admin_state_up': {'allow_post': True, 'allow_put': True,244                           'default': True,245                           'convert_to': attr.convert_to_boolean,246                           'is_visible': True},247        'status': {'allow_post': False, 'allow_put': False,248                   'is_visible': True},249        'status_description': {'allow_post': False, 'allow_put': False,250                               'is_visible': True},251        'pools': {'allow_post': False, 'allow_put': False,252                  'is_visible': True}253    }254}255SUB_RESOURCE_ATTRIBUTE_MAP = {256    'health_monitors': {257        'parent': {'collection_name': 'pools',258                   'member_name': 'pool'},259        'parameters': {'id': {'allow_post': True, 'allow_put': False,260                              'validate': {'type:uuid': None},261                              'is_visible': True},262                       'tenant_id': {'allow_post': True, 'allow_put': False,263                                     'validate': {'type:string': None},264                                     'required_by_policy': True,265                                     'is_visible': True},266                       }267    }268}269lbaas_quota_opts = [270    cfg.IntOpt('quota_vip',271               default=10,272               help=_('Number of vips allowed per tenant. '273                      'A negative value means unlimited.')),274    cfg.IntOpt('quota_pool',275               default=10,276               help=_('Number of pools allowed per tenant. '277                      'A negative value means unlimited.')),278    cfg.IntOpt('quota_member',279               default=-1,280               help=_('Number of pool members allowed per tenant. '281                      'A negative value means unlimited.')),282    cfg.IntOpt('quota_health_monitor',283               default=-1,284               help=_('Number of health monitors allowed per tenant. '285                      'A negative value means unlimited.'))286]287cfg.CONF.register_opts(lbaas_quota_opts, 'QUOTAS')288class Loadbalancer(extensions.ExtensionDescriptor):289    @classmethod290    def get_name(cls):291        return "LoadBalancing service"292    @classmethod293    def get_alias(cls):294        return "lbaas"295    @classmethod296    def get_description(cls):297        return "Extension for LoadBalancing service"298    @classmethod299    def get_namespace(cls):300        return "http://wiki.openstack.org/neutron/LBaaS/API_1.0"301    @classmethod302    def get_updated(cls):303        return "2012-10-07T10:00:00-00:00"304    @classmethod305    def get_resources(cls):306        plural_mappings = resource_helper.build_plural_mappings(307            {}, RESOURCE_ATTRIBUTE_MAP)308        plural_mappings['health_monitors_status'] = 'health_monitor_status'309        attr.PLURALS.update(plural_mappings)310        action_map = {'pool': {'stats': 'GET'}}311        resources = resource_helper.build_resource_info(plural_mappings,312                                                        RESOURCE_ATTRIBUTE_MAP,313                                                        constants.LOADBALANCER,314                                                        action_map=action_map,315                                                        register_quota=True)316        plugin = manager.NeutronManager.get_service_plugins()[317            constants.LOADBALANCER]318        for collection_name in SUB_RESOURCE_ATTRIBUTE_MAP:319            # Special handling needed for sub-resources with 'y' ending320            # (e.g. proxies -> proxy)321            resource_name = collection_name[:-1]322            parent = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get('parent')323            params = SUB_RESOURCE_ATTRIBUTE_MAP[collection_name].get(324                'parameters')325            controller = base.create_resource(collection_name, resource_name,326                                              plugin, params,327                                              allow_bulk=True,328                                              parent=parent)329            resource = extensions.ResourceExtension(330                collection_name,331                controller, parent,332                path_prefix=constants.COMMON_PREFIXES[constants.LOADBALANCER],333                attr_map=params)334            resources.append(resource)335        return resources336    @classmethod337    def get_plugin_interface(cls):338        return LoadBalancerPluginBase339    def update_attributes_map(self, attributes):340        super(Loadbalancer, self).update_attributes_map(341            attributes, extension_attrs_map=RESOURCE_ATTRIBUTE_MAP)342    def get_extended_resources(self, version):343        if version == "2.0":344            return RESOURCE_ATTRIBUTE_MAP345        else:346            return {}347@six.add_metaclass(abc.ABCMeta)348class LoadBalancerPluginBase(service_base.ServicePluginBase):349    def get_plugin_name(self):350        return constants.LOADBALANCER351    def get_plugin_type(self):352        return constants.LOADBALANCER353    def get_plugin_description(self):354        return 'LoadBalancer service plugin'355    @abc.abstractmethod356    def get_vips(self, context, filters=None, fields=None):357        pass358    @abc.abstractmethod359    def get_vip(self, context, id, fields=None):360        pass361    @abc.abstractmethod362    def create_vip(self, context, vip):363        pass364    @abc.abstractmethod365    def update_vip(self, context, id, vip):366        pass367    @abc.abstractmethod368    def delete_vip(self, context, id):369        pass370    @abc.abstractmethod371    def get_pools(self, context, filters=None, fields=None):372        pass373    @abc.abstractmethod374    def get_pool(self, context, id, fields=None):375        pass376    @abc.abstractmethod377    def create_pool(self, context, pool):378        pass379    @abc.abstractmethod380    def update_pool(self, context, id, pool):381        pass382    @abc.abstractmethod383    def delete_pool(self, context, id):384        pass385    @abc.abstractmethod386    def stats(self, context, pool_id):387        pass388    @abc.abstractmethod389    def create_pool_health_monitor(self, context, health_monitor, pool_id):390        pass391    @abc.abstractmethod392    def get_pool_health_monitor(self, context, id, pool_id, fields=None):393        pass394    @abc.abstractmethod395    def delete_pool_health_monitor(self, context, id, pool_id):396        pass397    @abc.abstractmethod398    def get_members(self, context, filters=None, fields=None):399        pass400    @abc.abstractmethod401    def get_member(self, context, id, fields=None):402        pass403    @abc.abstractmethod404    def create_member(self, context, member):405        pass406    @abc.abstractmethod407    def update_member(self, context, id, member):408        pass409    @abc.abstractmethod410    def delete_member(self, context, id):411        pass412    @abc.abstractmethod413    def get_health_monitors(self, context, filters=None, fields=None):414        pass415    @abc.abstractmethod416    def get_health_monitor(self, context, id, fields=None):417        pass418    @abc.abstractmethod419    def create_health_monitor(self, context, health_monitor):420        pass421    @abc.abstractmethod422    def update_health_monitor(self, context, id, health_monitor):423        pass424    @abc.abstractmethod425    def delete_health_monitor(self, context, id):...vpnaas.py
Source:vpnaas.py  
1#    (c) Copyright 2013 Hewlett-Packard Development Company, L.P.2#    All Rights Reserved.3#4#    Licensed under the Apache License, Version 2.0 (the "License"); you may5#    not use this file except in compliance with the License. You may obtain6#    a copy of the License at7#8#         http://www.apache.org/licenses/LICENSE-2.09#10#    Unless required by applicable law or agreed to in writing, software11#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13#    License for the specific language governing permissions and limitations14#    under the License.15import abc16import six17from neutron.api import extensions18from neutron.api.v2 import attributes as attr19from neutron.api.v2 import resource_helper20from neutron.common import exceptions as qexception21from neutron.plugins.common import constants22from neutron.services import service_base23class VPNServiceNotFound(qexception.NotFound):24    message = _("VPNService %(vpnservice_id)s could not be found")25class IPsecSiteConnectionNotFound(qexception.NotFound):26    message = _("ipsec_site_connection %(ipsec_site_conn_id)s not found")27class IPsecSiteConnectionDpdIntervalValueError(qexception.InvalidInput):28    message = _("ipsec_site_connection %(attr)s is "29                "equal to or less than dpd_interval")30class IPsecSiteConnectionMtuError(qexception.InvalidInput):31    message = _("ipsec_site_connection MTU %(mtu)d is too small "32                "for ipv%(version)s")33class IKEPolicyNotFound(qexception.NotFound):34    message = _("IKEPolicy %(ikepolicy_id)s could not be found")35class IPsecPolicyNotFound(qexception.NotFound):36    message = _("IPsecPolicy %(ipsecpolicy_id)s could not be found")37class IKEPolicyInUse(qexception.InUse):38    message = _("IKEPolicy %(ikepolicy_id)s is in use by existing "39                "IPsecSiteConnection and can't be updated or deleted")40class VPNServiceInUse(qexception.InUse):41    message = _("VPNService %(vpnservice_id)s is still in use")42class RouterInUseByVPNService(qexception.InUse):43    message = _("Router %(router_id)s is used by VPNService %(vpnservice_id)s")44class VPNStateInvalidToUpdate(qexception.BadRequest):45    message = _("Invalid state %(state)s of vpnaas resource %(id)s"46                " for updating")47class IPsecPolicyInUse(qexception.InUse):48    message = _("IPsecPolicy %(ipsecpolicy_id)s is in use by existing "49                "IPsecSiteConnection and can't be updated or deleted")50class DeviceDriverImportError(qexception.NeutronException):51    message = _("Can not load driver :%(device_driver)s")52class SubnetIsNotConnectedToRouter(qexception.BadRequest):53    message = _("Subnet %(subnet_id)s is not "54                "connected to Router %(router_id)s")55class RouterIsNotExternal(qexception.BadRequest):56    message = _("Router %(router_id)s has no external network gateway set")57vpn_supported_initiators = ['bi-directional', 'response-only']58vpn_supported_encryption_algorithms = ['3des', 'aes-128',59                                       'aes-192', 'aes-256']60vpn_dpd_supported_actions = [61    'hold', 'clear', 'restart', 'restart-by-peer', 'disabled'62]63vpn_supported_transform_protocols = ['esp', 'ah', 'ah-esp']64vpn_supported_encapsulation_mode = ['tunnel', 'transport']65#TODO(nati) add kilobytes when we support it66vpn_supported_lifetime_units = ['seconds']67vpn_supported_pfs = ['group2', 'group5', 'group14']68vpn_supported_ike_versions = ['v1', 'v2']69vpn_supported_auth_mode = ['psk']70vpn_supported_auth_algorithms = ['sha1']71vpn_supported_phase1_negotiation_mode = ['main']72vpn_lifetime_limits = (60, attr.UNLIMITED)73positive_int = (0, attr.UNLIMITED)74RESOURCE_ATTRIBUTE_MAP = {75    'vpnservices': {76        'id': {'allow_post': False, 'allow_put': False,77               'validate': {'type:uuid': None},78               'is_visible': True,79               'primary_key': True},80        'tenant_id': {'allow_post': True, 'allow_put': False,81                      'validate': {'type:string': None},82                      'required_by_policy': True,83                      'is_visible': True},84        'name': {'allow_post': True, 'allow_put': True,85                 'validate': {'type:string': None},86                 'is_visible': True, 'default': ''},87        'description': {'allow_post': True, 'allow_put': True,88                        'validate': {'type:string': None},89                        'is_visible': True, 'default': ''},90        'subnet_id': {'allow_post': True, 'allow_put': False,91                      'validate': {'type:uuid': None},92                      'is_visible': True},93        'router_id': {'allow_post': True, 'allow_put': False,94                      'validate': {'type:uuid': None},95                      'is_visible': True},96        'admin_state_up': {'allow_post': True, 'allow_put': True,97                           'default': True,98                           'convert_to': attr.convert_to_boolean,99                           'is_visible': True},100        'status': {'allow_post': False, 'allow_put': False,101                   'is_visible': True}102    },103    'ipsec_site_connections': {104        'id': {'allow_post': False, 'allow_put': False,105               'validate': {'type:uuid': None},106               'is_visible': True,107               'primary_key': True},108        'tenant_id': {'allow_post': True, 'allow_put': False,109                      'validate': {'type:string': None},110                      'required_by_policy': True,111                      'is_visible': True},112        'name': {'allow_post': True, 'allow_put': True,113                 'validate': {'type:string': None},114                 'is_visible': True, 'default': ''},115        'description': {'allow_post': True, 'allow_put': True,116                        'validate': {'type:string': None},117                        'is_visible': True, 'default': ''},118        'peer_address': {'allow_post': True, 'allow_put': True,119                         'validate': {'type:string': None},120                         'is_visible': True},121        'peer_id': {'allow_post': True, 'allow_put': True,122                    'validate': {'type:string': None},123                    'is_visible': True},124        'peer_cidrs': {'allow_post': True, 'allow_put': True,125                       'convert_to': attr.convert_to_list,126                       'validate': {'type:subnet_list': None},127                       'is_visible': True},128        'route_mode': {'allow_post': False, 'allow_put': False,129                       'default': 'static',130                       'is_visible': True},131        'mtu': {'allow_post': True, 'allow_put': True,132                'default': '1500',133                'validate': {'type:range': positive_int},134                'convert_to': attr.convert_to_int,135                'is_visible': True},136        'initiator': {'allow_post': True, 'allow_put': True,137                      'default': 'bi-directional',138                      'validate': {'type:values': vpn_supported_initiators},139                      'is_visible': True},140        'auth_mode': {'allow_post': False, 'allow_put': False,141                      'default': 'psk',142                      'validate': {'type:values': vpn_supported_auth_mode},143                      'is_visible': True},144        'psk': {'allow_post': True, 'allow_put': True,145                'validate': {'type:string': None},146                'is_visible': True},147        'dpd': {'allow_post': True, 'allow_put': True,148                'convert_to': attr.convert_none_to_empty_dict,149                'is_visible': True,150                'default': {},151                'validate': {152                    'type:dict_or_empty': {153                        'actions': {154                            'type:values': vpn_dpd_supported_actions,155                        },156                        'interval': {157                            'type:range': positive_int158                        },159                        'timeout': {160                            'type:range': positive_int161                        }}}},162        'admin_state_up': {'allow_post': True, 'allow_put': True,163                           'default': True,164                           'convert_to': attr.convert_to_boolean,165                           'is_visible': True},166        'status': {'allow_post': False, 'allow_put': False,167                   'is_visible': True},168        'vpnservice_id': {'allow_post': True, 'allow_put': False,169                          'validate': {'type:uuid': None},170                          'is_visible': True},171        'ikepolicy_id': {'allow_post': True, 'allow_put': False,172                         'validate': {'type:uuid': None},173                         'is_visible': True},174        'ipsecpolicy_id': {'allow_post': True, 'allow_put': False,175                           'validate': {'type:uuid': None},176                           'is_visible': True}177    },178    'ipsecpolicies': {179        'id': {'allow_post': False, 'allow_put': False,180               'validate': {'type:uuid': None},181               'is_visible': True,182               'primary_key': True},183        'tenant_id': {'allow_post': True, 'allow_put': False,184                      'validate': {'type:string': None},185                      'required_by_policy': True,186                      'is_visible': True},187        'name': {'allow_post': True, 'allow_put': True,188                 'validate': {'type:string': None},189                 'is_visible': True, 'default': ''},190        'description': {'allow_post': True, 'allow_put': True,191                        'validate': {'type:string': None},192                        'is_visible': True, 'default': ''},193        'transform_protocol': {194            'allow_post': True,195            'allow_put': True,196            'default': 'esp',197            'validate': {198                'type:values': vpn_supported_transform_protocols},199            'is_visible': True},200        'auth_algorithm': {201            'allow_post': True,202            'allow_put': True,203            'default': 'sha1',204            'validate': {205                'type:values': vpn_supported_auth_algorithms206            },207            'is_visible': True},208        'encryption_algorithm': {209            'allow_post': True,210            'allow_put': True,211            'default': 'aes-128',212            'validate': {213                'type:values': vpn_supported_encryption_algorithms214            },215            'is_visible': True},216        'encapsulation_mode': {217            'allow_post': True,218            'allow_put': True,219            'default': 'tunnel',220            'validate': {221                'type:values': vpn_supported_encapsulation_mode222            },223            'is_visible': True},224        'lifetime': {'allow_post': True, 'allow_put': True,225                     'convert_to': attr.convert_none_to_empty_dict,226                     'default': {},227                     'validate': {228                         'type:dict_or_empty': {229                             'units': {230                                 'type:values': vpn_supported_lifetime_units,231                             },232                             'value': {233                                 'type:range': vpn_lifetime_limits234                             }}},235                     'is_visible': True},236        'pfs': {'allow_post': True, 'allow_put': True,237                'default': 'group5',238                'validate': {'type:values': vpn_supported_pfs},239                'is_visible': True}240    },241    'ikepolicies': {242        'id': {'allow_post': False, 'allow_put': False,243               'validate': {'type:uuid': None},244               'is_visible': True,245               'primary_key': True},246        'tenant_id': {'allow_post': True, 'allow_put': False,247                      'validate': {'type:string': None},248                      'required_by_policy': True,249                      'is_visible': True},250        'name': {'allow_post': True, 'allow_put': True,251                 'validate': {'type:string': None},252                 'is_visible': True, 'default': ''},253        'description': {'allow_post': True, 'allow_put': True,254                        'validate': {'type:string': None},255                        'is_visible': True, 'default': ''},256        'auth_algorithm': {'allow_post': True, 'allow_put': True,257                           'default': 'sha1',258                           'validate': {259                               'type:values': vpn_supported_auth_algorithms},260                           'is_visible': True},261        'encryption_algorithm': {262            'allow_post': True, 'allow_put': True,263            'default': 'aes-128',264            'validate': {'type:values': vpn_supported_encryption_algorithms},265            'is_visible': True},266        'phase1_negotiation_mode': {267            'allow_post': True, 'allow_put': True,268            'default': 'main',269            'validate': {270                'type:values': vpn_supported_phase1_negotiation_mode271            },272            'is_visible': True},273        'lifetime': {'allow_post': True, 'allow_put': True,274                     'convert_to': attr.convert_none_to_empty_dict,275                     'default': {},276                     'validate': {277                         'type:dict_or_empty': {278                             'units': {279                                 'type:values': vpn_supported_lifetime_units,280                             },281                             'value': {282                                 'type:range': vpn_lifetime_limits,283                             }}},284                     'is_visible': True},285        'ike_version': {'allow_post': True, 'allow_put': True,286                        'default': 'v1',287                        'validate': {288                            'type:values': vpn_supported_ike_versions},289                        'is_visible': True},290        'pfs': {'allow_post': True, 'allow_put': True,291                'default': 'group5',292                'validate': {'type:values': vpn_supported_pfs},293                'is_visible': True}294    }295}296class Vpnaas(extensions.ExtensionDescriptor):297    @classmethod298    def get_name(cls):299        return "VPN service"300    @classmethod301    def get_alias(cls):302        return "vpnaas"303    @classmethod304    def get_description(cls):305        return "Extension for VPN service"306    @classmethod307    def get_namespace(cls):308        return "https://wiki.openstack.org/Neutron/VPNaaS"309    @classmethod310    def get_updated(cls):311        return "2013-05-29T10:00:00-00:00"312    @classmethod313    def get_resources(cls):314        special_mappings = {'ikepolicies': 'ikepolicy',315                            'ipsecpolicies': 'ipsecpolicy'}316        plural_mappings = resource_helper.build_plural_mappings(317            special_mappings, RESOURCE_ATTRIBUTE_MAP)318        plural_mappings['peer_cidrs'] = 'peer_cidr'319        attr.PLURALS.update(plural_mappings)320        return resource_helper.build_resource_info(plural_mappings,321                                                   RESOURCE_ATTRIBUTE_MAP,322                                                   constants.VPN,323                                                   register_quota=True,324                                                   translate_name=True)325    @classmethod326    def get_plugin_interface(cls):327        return VPNPluginBase328    def update_attributes_map(self, attributes):329        super(Vpnaas, self).update_attributes_map(330            attributes, extension_attrs_map=RESOURCE_ATTRIBUTE_MAP)331    def get_extended_resources(self, version):332        if version == "2.0":333            return RESOURCE_ATTRIBUTE_MAP334        else:335            return {}336@six.add_metaclass(abc.ABCMeta)337class VPNPluginBase(service_base.ServicePluginBase):338    def get_plugin_name(self):339        return constants.VPN340    def get_plugin_type(self):341        return constants.VPN342    def get_plugin_description(self):343        return 'VPN service plugin'344    @abc.abstractmethod345    def get_vpnservices(self, context, filters=None, fields=None):346        pass347    @abc.abstractmethod348    def get_vpnservice(self, context, vpnservice_id, fields=None):349        pass350    @abc.abstractmethod351    def create_vpnservice(self, context, vpnservice):352        pass353    @abc.abstractmethod354    def update_vpnservice(self, context, vpnservice_id, vpnservice):355        pass356    @abc.abstractmethod357    def delete_vpnservice(self, context, vpnservice_id):358        pass359    @abc.abstractmethod360    def get_ipsec_site_connections(self, context, filters=None, fields=None):361        pass362    @abc.abstractmethod363    def get_ipsec_site_connection(self, context,364                                  ipsecsite_conn_id, fields=None):365        pass366    @abc.abstractmethod367    def create_ipsec_site_connection(self, context, ipsec_site_connection):368        pass369    @abc.abstractmethod370    def update_ipsec_site_connection(self, context,371                                     ipsecsite_conn_id, ipsec_site_connection):372        pass373    @abc.abstractmethod374    def delete_ipsec_site_connection(self, context, ipsecsite_conn_id):375        pass376    @abc.abstractmethod377    def get_ikepolicy(self, context, ikepolicy_id, fields=None):378        pass379    @abc.abstractmethod380    def get_ikepolicies(self, context, filters=None, fields=None):381        pass382    @abc.abstractmethod383    def create_ikepolicy(self, context, ikepolicy):384        pass385    @abc.abstractmethod386    def update_ikepolicy(self, context, ikepolicy_id, ikepolicy):387        pass388    @abc.abstractmethod389    def delete_ikepolicy(self, context, ikepolicy_id):390        pass391    @abc.abstractmethod392    def get_ipsecpolicies(self, context, filters=None, fields=None):393        pass394    @abc.abstractmethod395    def get_ipsecpolicy(self, context, ipsecpolicy_id, fields=None):396        pass397    @abc.abstractmethod398    def create_ipsecpolicy(self, context, ipsecpolicy):399        pass400    @abc.abstractmethod401    def update_ipsecpolicy(self, context, ipsecpolicy_id, ipsecpolicy):402        pass403    @abc.abstractmethod404    def delete_ipsecpolicy(self, context, ipsecpolicy_id):...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
