@@ -465,6 +465,109 @@ describe.skip('DirectLinkV1', () => {
465465 } ) ;
466466 } ) ;
467467
468+ describe ( 'Gateway AS Prepends' , ( ) => {
469+ jest . setTimeout ( timeout ) ;
470+
471+ // AsPrependTemplate
472+ const asPrependTemplate = {
473+ length : 4 ,
474+ policy : 'import' ,
475+ prefix : '172.17.0.0/16' ,
476+ } ;
477+
478+ // AsPrependPrefixArrayTemplate
479+ const asPrependPrefixArrayTemplate = {
480+ length : 4 ,
481+ policy : 'import' ,
482+ specific_prefixes : [ '192.168.3.0/24' ] ,
483+ } ;
484+
485+ // GatewayTemplate for dedicated gateway
486+ const gatewayTemplate = {
487+ as_prepends : [ asPrependTemplate ] ,
488+ name : 'NODE-INT-SDK-DEDICATED-ASP' + timestamp ,
489+ type : 'dedicated' ,
490+ speed_mbps : 1000 ,
491+ global : true ,
492+ bgp_asn : 64999 ,
493+ bgp_base_cidr : '169.254.0.0/16' ,
494+ metered : false ,
495+ carrier_name : 'myCarrierName' ,
496+ customer_name : 'newCustomerName' ,
497+ cross_connect_router : 'LAB-xcr01.dal09' ,
498+ location_name : config . LOCATION_NAME ,
499+ } ;
500+
501+ // Save the ID for list as_prepends and deletion
502+ let gatewayId = '' ;
503+
504+ // create a dedicated gateway and verify the results
505+ it ( 'Successfully create a dedicated gateway' , done => {
506+ const params = {
507+ gatewayTemplate : gatewayTemplate ,
508+ } ;
509+ try {
510+ dlService . createGateway ( params ) . then ( response => {
511+ expect ( response . status ) . toBe ( 201 ) ;
512+ expect ( response . result . id ) . toBeDefined ( ) ;
513+ if ( null != response && null != response . result && null != response . result . id ) {
514+ gatewayId = response . result . id ;
515+ }
516+ done ( ) ;
517+ } ) ;
518+ } catch ( err ) {
519+ done ( err ) ;
520+ }
521+ } ) ;
522+
523+ it ( 'Successfully get the list of AS prepends for the gateway' , done => {
524+ try {
525+ dlService . listGatewayAsPrepends ( { gatewayId } ) . then ( response => {
526+ expect ( response ) . toBeDefined ( ) ;
527+ expect ( response . status ) . toBe ( 200 ) ;
528+ // two virtual connectins were created for the gateway, make sure the list has two
529+ expect ( Object . keys ( response . result . as_prepends ) . length ) . toBe ( 1 ) ;
530+ done ( ) ;
531+ } ) ;
532+ } catch ( err ) {
533+ done ( err ) ;
534+ }
535+ } ) ;
536+
537+ const ifMatch = 'W/"96d225c4-56bd-43d9-98fc-d7148e5c5028"' ;
538+ const asPrepends = [ asPrependPrefixArrayTemplate ] ;
539+
540+ it ( 'Successfully replace the given set of AS prepends on the gateway' , done => {
541+ try {
542+ dlService
543+ . replaceGatewayAsPrepends ( {
544+ gatewayId,
545+ ifMatch,
546+ asPrepends,
547+ } )
548+ . then ( response => {
549+ expect ( response ) . toBeDefined ( ) ;
550+ expect ( response . status ) . toBe ( 200 ) ;
551+ done ( ) ;
552+ } ) ;
553+ } catch ( err ) {
554+ done ( err ) ;
555+ }
556+ } ) ;
557+
558+ // delete the gateway
559+ it ( 'Successfully delete the gateway' , done => {
560+ try {
561+ dlService . deleteGateway ( { id : gatewayId } ) . then ( response => {
562+ expect ( response . status ) . toBe ( 204 ) ;
563+ done ( ) ;
564+ } ) ;
565+ } catch ( err ) {
566+ done ( err ) ;
567+ }
568+ } ) ;
569+ } ) ;
570+
468571 describe ( 'DirectLink virtual connections' , ( ) => {
469572 jest . setTimeout ( timeout ) ;
470573
0 commit comments